Skip to content

Commit

Permalink
Allow getting it's at non-existent depth
Browse files Browse the repository at this point in the history
Fixes #114
  • Loading branch information
vespakoen committed Mar 14, 2016
1 parent 130a245 commit e1466ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Menu/Items/ItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,10 @@ public function getItemListsAtDepthRange($from, $to)
public function getItemsAtDepth($depth)
{
$itemsWithDepth = $this->getItemsWithDepth();

return new MenuHandler($itemsWithDepth[$depth]);
if (array_key_exists($depth, $itemsWithDepth)) {
return new MenuHandler($itemsWithDepth[$depth]);
}
return new MenuHandler(array());
}

/**
Expand Down

0 comments on commit e1466ac

Please sign in to comment.