mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 22:34:24 +02:00
Navigation: Fix method getActiveItem() failing badly for empty navigations
refs #5600
This commit is contained in:
parent
6dd49761ff
commit
a3539b0817
@ -228,14 +228,14 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate
|
||||
*/
|
||||
public function getActiveItem()
|
||||
{
|
||||
$firstItem = reset($this->items);
|
||||
foreach ($this->items as $item) {
|
||||
if ($item->getActive()) {
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
return $firstItem->setActive();
|
||||
$firstItem = reset($this->items);
|
||||
return $firstItem ? $firstItem->setActive() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user