Skip to content

Commit afbaada

Browse files
committed
Allow getting ItemLists at non-existent depth
1 parent e1466ac commit afbaada

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
@@ -459,8 +459,10 @@ public function getAllItemListsIncludingThisOne()
459459
public function getItemListsAtDepth($depth)
460460
{
461461
$itemListsWithDepth = $this->getItemListsWithDepth();
462-
463-
return new MenuHandler($itemListsWithDepth[$depth]);
462+
if (array_key_exists($depth, $itemListsWithDepth)) {
463+
return new MenuHandler($itemListsWithDepth[$depth]);
464+
}
465+
return new MenuHandler(array());
464466
}
465467

466468
/**

0 commit comments

Comments
 (0)