Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-40191 MDLSITE-2455 Do not throw coding exception when the activit…

…y is not found

Under certain conditions, coding exception is thrown when fetching items from
the navigation bar. The patch prevents them. See more details in the tracker.
  • Loading branch information...
commit 22bf788f6b7d51bcdfba0ec317e5e5bb112041e1 1 parent 828aff6
@mudrd8mz mudrd8mz authored marinaglancy committed
Showing with 8 additions and 6 deletions.
  1. +8 −6 lib/navigationlib.php
View
14 lib/navigationlib.php
@@ -1201,12 +1201,14 @@ public function initialise() {
// Load the course sections into the page
$this->load_course_sections($course, $coursenode, null, $cm);
$activity = $coursenode->find($cm->id, navigation_node::TYPE_ACTIVITY);
- // Finally load the cm specific navigaton information
- $this->load_activity($cm, $course, $activity);
- // Check if we have an active ndoe
- if (!$activity->contains_active_node() && !$activity->search_for_active_node()) {
- // And make the activity node active.
- $activity->make_active();
+ if (!empty($activity)) {
+ // Finally load the cm specific navigaton information
+ $this->load_activity($cm, $course, $activity);
+ // Check if we have an active ndoe
+ if (!$activity->contains_active_node() && !$activity->search_for_active_node()) {
+ // And make the activity node active.
+ $activity->make_active();
+ }
}
break;
case CONTEXT_USER :
Please sign in to comment.
Something went wrong with that request. Please try again.