MDL-33942 Grading method: Marking Guide - check for $cm before using - may not exist if the course is being deleted.

This commit is contained in:
Dan Marsden
2012-08-02 19:49:28 +12:00
parent 470d47f512
commit f43d3cf50f
+3 -1
View File
@@ -339,7 +339,9 @@ class gradingform_guide_controller extends gradingform_controller {
$modulename = substr($modulename, 4);
if ($dbman->table_exists($modulename)) {
$cm = get_coursemodule_from_id($modulename, $context->instanceid);
$this->moduleinstance = $DB->get_record($modulename, array("id"=>$cm->instance));
if (!empty($cm)) { // This should only occur when the course is being deleted.
$this->moduleinstance = $DB->get_record($modulename, array("id"=>$cm->instance));
}
}
}
}