From 98a7262818e0a4ccc9e1f21c9d78476fe399cccb Mon Sep 17 00:00:00 2001 From: CodeWithDennis Date: Thu, 16 Jul 2026 09:05:10 +0200 Subject: [PATCH] fix(select-tree): handle empty strict root results --- src/SelectTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SelectTree.php b/src/SelectTree.php index ac4963f..1845b7e 100644 --- a/src/SelectTree.php +++ b/src/SelectTree.php @@ -251,7 +251,7 @@ private function buildTreeFromResults($results, $parent = null): Collection // If the tree has strict rull parent root nodes, only retrieve children whose parent is the null value // Otherwise, promote other orphaned children to root nodes $orphanedResults = $this->hasStrictNullParentRootNodes() - ? [$parent => $resultCache[$parent]['children']] + ? [$parent => $resultCache[$parent]['children'] ?? []] : array_map( fn ($item) => $item['children'], array_filter(