From b66ff758d6165a07cc2bef7ac55115a9c042d492 Mon Sep 17 00:00:00 2001 From: blackcoder87 Date: Sun, 16 Jul 2023 08:27:15 +0200 Subject: [PATCH] Gallery: Fix errors when trying to delete a category. (#705) Fix "key_exists(): Argument ($array) must be of type array, null given" Fix "foreach() argument must be of type array|object, null given" --- application/modules/gallery/controllers/admin/Index.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/application/modules/gallery/controllers/admin/Index.php b/application/modules/gallery/controllers/admin/Index.php index 8a345b03e..38d5c0ae1 100644 --- a/application/modules/gallery/controllers/admin/Index.php +++ b/application/modules/gallery/controllers/admin/Index.php @@ -42,13 +42,11 @@ public function indexAction() $galleryMapper = new GalleryMapper(); $imageMapper = new ImageMapper(); - /* - * Saves the item tree to database. - */ + // Saves the item tree to database. if ($this->getRequest()->isPost()) { if ($this->getRequest()->getPost('save')) { $sortItems = json_decode($this->getRequest()->getPost('hiddenMenu')); - $items = $this->getRequest()->getPost('items'); + $items = $this->getRequest()->getPost('items') ?? []; foreach ($items as $item) { $validation = Validation::create($item, [