MDL-73732 navigation: Do not assume output of find_active_node
When handling with the output of find_active_node, proceed ahead only if the result is an instance of navigation_node. Else there are chances of exceptions.
This commit is contained in:
@@ -4042,9 +4042,11 @@ class flat_navigation_node extends navigation_node {
|
||||
|
||||
if ($this->is_section()) {
|
||||
$active = $PAGE->navigation->find_active_node();
|
||||
while ($active = $active->parent) {
|
||||
if ($active->key == $this->key && $active->type == $this->type) {
|
||||
return true;
|
||||
if ($active) {
|
||||
while ($active = $active->parent) {
|
||||
if ($active->key == $this->key && $active->type == $this->type) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user