From 5280943099901617c81318d27c225c64c0553780 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Mon, 7 Jul 2025 10:10:38 +0200 Subject: [PATCH] fix(Studium):checks if the query of the data in the studium endpoints returns an array otherwise return empty array to avoid breaking the endpoint --- application/controllers/api/frontend/v1/Studium.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/controllers/api/frontend/v1/Studium.php b/application/controllers/api/frontend/v1/Studium.php index 6f1eff18f..fb4d3ce3c 100644 --- a/application/controllers/api/frontend/v1/Studium.php +++ b/application/controllers/api/frontend/v1/Studium.php @@ -313,10 +313,12 @@ SELECT tbl_lehrveranstaltung.*, private function computeLektorenFromLehrveranstaltung($lehreinheit_id, $semester, $studiengang, $studiensemester){ $this->load->library('StundenplanLib'); $lektoren = $this->stundenplanlib->getLektorenFromLehrveranstaltung($lehreinheit_id,$semester, $studiengang,$studiensemester); - $lektoren = $this->getDataOrTerminateWithError($lektoren); + $lektoren = $this->getDataOrTerminateWithError($lektoren) ?? []; + $lektoren = array_map(function($lektor){ return ["name"=>$this->getDataOrTerminateWithError($this->PersonModel->getFullName($lektor)), "email"=>$lektor."@".DOMAIN]; },$lektoren); + return $lektoren; }