diff --git a/libraries/cms/html/menu.php b/libraries/cms/html/menu.php index 27b982ebcc89e..5bd4d22de9a03 100644 --- a/libraries/cms/html/menu.php +++ b/libraries/cms/html/menu.php @@ -351,7 +351,7 @@ public static function linkOptions($all = false, $unassigned = false, $clientId */ public static function treerecurse($id, $indent, $list, &$children, $maxlevel = 9999, $level = 0, $type = 1) { - if ($level <= $maxlevel && @$children[$id]) + if ($level <= $maxlevel && isset($children[$id]) && is_array($children[$id])) { if ($type) { @@ -379,8 +379,16 @@ public static function treerecurse($id, $indent, $list, &$children, $maxlevel = $list[$id] = $v; $list[$id]->treename = $indent . $txt; - $list[$id]->children = count(@$children[$id]); - $list = static::treerecurse($id, $indent . $spacer, $list, $children, $maxlevel, $level + 1, $type); + + if (isset($children[$id]) && is_array($children[$id])) + { + $list[$id]->children = count($children[$id]); + $list = static::treerecurse($id, $indent . $spacer, $list, $children, $maxlevel, $level + 1, $type); + } + else + { + $list[$id]->children = 0; + } } }