diff --git a/grade/lib.php b/grade/lib.php index 7e8e834a906..2a3becfbeec 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -852,7 +852,9 @@ class grade_structure { $iteminstance = $element['object']->iteminstance; if ($withlink and $itemtype=='mod' and $iteminstance and $itemmodule) { - $cm = get_coursemodule_from_instance($itemmodule, $iteminstance, $this->courseid); + if (!$cm = get_coursemodule_from_instance($itemmodule, $iteminstance, $this->courseid)) { + continue; + } $dir = $CFG->dirroot.'/mod/'.$itemmodule;