Permalink
Browse files

MDL-33942 Grading method: Marking Guide - check for $cm before using …

…- may not exist if the course is being deleted.
  • Loading branch information...
1 parent 02814bf commit 605d6ffcf4d04817078f781a98f99991e435040f @danmarsden danmarsden committed Aug 2, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 grade/grading/form/guide/lib.php
@@ -339,7 +339,9 @@ protected function load_definition() {
$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));
+ }
}
}
}

0 comments on commit 605d6ff

Please sign in to comment.