From: skodak <skodak>
Date: Sun, 17 Feb 2008 18:38:44 +0000 (+0000)
Subject: MDL-12934 temporary fix for grade items of activities without proper course module... 
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2be2c4c2cd3afb831a5108a0eeacfb2108afa248;p=moodle.git

MDL-12934 temporary fix for grade items of activities without proper course module record; merged from MOODLE_19_STABLE
---

diff --git a/grade/lib.php b/grade/lib.php
index 7e8e834a90..2a3becfbee 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;