From 23abf2663604a38c737cbfe11880a38f93a5eaa8 Mon Sep 17 00:00:00 2001 From: "r.fabiani" Date: Fri, 27 Sep 2024 15:38:54 +0200 Subject: [PATCH] Return early if no nested categories retrieved --- ps_categorytree.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ps_categorytree.php b/ps_categorytree.php index 6e9efa9..5e4c617 100644 --- a/ps_categorytree.php +++ b/ps_categorytree.php @@ -139,6 +139,9 @@ private function getCategories($category): array // Retrieve them using the built in method $categories = Category::getNestedCategories($category->id, $this->context->language->id, true, $groups, true, $sqlFilter, $orderBy); + if (empty($categories)) { + return []; + } // Get path to current category so we can use it for marking $idsOfCategoriesInPath = $this->getIdsOfCategoriesInPathToCurrentCategory();