From 905a2dadff8ed2855d8878bbb7e11e57cf97e078 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 19 Aug 2025 17:18:57 +0200 Subject: [PATCH] terminate with error if receiver person_id or prestudent_id is not found --- .../controllers/api/frontend/v1/messages/Messages.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/application/controllers/api/frontend/v1/messages/Messages.php b/application/controllers/api/frontend/v1/messages/Messages.php index dbc11735a..fa6748f6a 100644 --- a/application/controllers/api/frontend/v1/messages/Messages.php +++ b/application/controllers/api/frontend/v1/messages/Messages.php @@ -418,6 +418,10 @@ class Messages extends FHCAPI_Controller } $data = $this->getDataOrTerminateWithError($result); + if (count($data) < 1) + { + $this->terminateWithError('Error: Messages API no person_id found.'); + } $person = current($data); return $person->person_id; @@ -432,8 +436,12 @@ class Messages extends FHCAPI_Controller ); $data = $this->getDataOrTerminateWithError($result); + if (count($data) < 1) + { + $this->terminateWithError('Error: Messages API no prestudent_id found.'); + } $student = current($data); - // $this->terminateWithError($student->prestudent_id, self::ERROR_TYPE_GENERAL); + return $student->prestudent_id; }