From 5e1ec0dd73963ddb5a7e385e797a80e2bb43546c Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Tue, 26 May 2026 19:47:58 +0300 Subject: [PATCH] handle missing element --- backend/app/Controllers/ElementController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/app/Controllers/ElementController.php b/backend/app/Controllers/ElementController.php index 7d23213..9e61720 100644 --- a/backend/app/Controllers/ElementController.php +++ b/backend/app/Controllers/ElementController.php @@ -14,6 +14,11 @@ class ElementController public function show(int $id): JsonResponse { $element = $this->elementRepository->find($id); + if ($element === null) { + return new JsonResponse([ + 'error' => 'Element not found', + ], 404); + } return new JsonResponse([ 'element' => [