MDL-56834 boost: Be cautious about nodes in the navbar

Some pages (fresh install) don't have the navbar yet, so check for null.
This commit is contained in:
Damyon Wiese 2016-11-14 17:16:38 +08:00
parent d017e3fb48
commit cf199b4448

View File

@ -619,7 +619,7 @@ class core_renderer extends \core_renderer {
$navbarnode = end($items);
// We only want to show the menu on the first page of the activity. This means
// the breadcrumb has no additional nodes.
if ($navbarnode->key == $node->key && $navbarnode->type == $node->type) {
if ($navbarnode && ($navbarnode->key == $node->key && $navbarnode->type == $node->type)) {
$buildmenu = true;
}
}
@ -635,7 +635,7 @@ class core_renderer extends \core_renderer {
$items = $this->page->navbar->get_items();
$navbarnode = end($items);
if ($navbarnode->key == 'participants') {
if ($navbarnode && ($navbarnode->key == 'participants')) {
$node = $this->page->settingsnav->find('users', navigation_node::TYPE_CONTAINER);
if ($node) {
// Build an action menu based on the visible nodes from this navigation tree.