Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit f43d3cf50fd3071c0ea695900c97a232afb5ca8c 1 parent 470d47f
Dan Marsden danmarsden authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 grade/grading/form/guide/lib.php
4 grade/grading/form/guide/lib.php
View
@@ -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));
+ }
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.