]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12900 prevent fatal errors when incorrect scale id specified in grade_item; merge...
authorskodak <skodak>
Sat, 2 Feb 2008 21:34:08 +0000 (21:34 +0000)
committerskodak <skodak>
Sat, 2 Feb 2008 21:34:08 +0000 (21:34 +0000)
lib/grade/grade_item.php

index 0db6c37080da87a0b14fa7888eec2261e7e230ed..9f94529c3fd2c1051264e7d3e8be564079372f32 100644 (file)
@@ -785,6 +785,11 @@ class grade_item extends grade_object {
             //do not load scale if already present
             if (empty($this->scale->id) or $this->scale->id != $this->scaleid) {
                 $this->scale = grade_scale::fetch(array('id'=>$this->scaleid));
+                if (!$this->scale) {
+                    debugging('Incorrect scale id: '.$this->scaleid);
+                    $this->scale = null;
+                    return null;
+                }
                 $this->scale->load_items();
             }