Skip to content

Commit e1466ac

Browse files
committed
Allow getting it's at non-existent depth
Fixes #114
1 parent 130a245 commit e1466ac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Menu/Items/ItemList.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,10 @@ public function getItemListsAtDepthRange($from, $to)
495495
public function getItemsAtDepth($depth)
496496
{
497497
$itemsWithDepth = $this->getItemsWithDepth();
498-
499-
return new MenuHandler($itemsWithDepth[$depth]);
498+
if (array_key_exists($depth, $itemsWithDepth)) {
499+
return new MenuHandler($itemsWithDepth[$depth]);
500+
}
501+
return new MenuHandler(array());
500502
}
501503

502504
/**

0 commit comments

Comments
 (0)