]> git.mjollnir.org Git - moodle.git/commitdiff
More robust variable checking
authormoodler <moodler>
Thu, 24 Apr 2003 17:13:52 +0000 (17:13 +0000)
committermoodler <moodler>
Thu, 24 Apr 2003 17:13:52 +0000 (17:13 +0000)
mod/quiz/lib.php

index 5016acb12e6280ad146de964d9524e15e1769176..5c108b46aab616216f295dbaca27c6e0ed18e659 100644 (file)
@@ -1367,7 +1367,11 @@ function quiz_grade_attempt_results($quiz, $questions) {
             if (!$question = get_record("quiz_questions", "id", $question->random)) {
                 error("Could not find the real question behind this random question!");
             }
-            $question->answer = $randomquestion->answer;
+            if (isset($randomquestion->answer)) {
+                $question->answer = $randomquestion->answer;
+            } else {
+                $question->answer = "";
+            }
             $question->grade = $grades[$randomquestion->id];
         } else {
             $question->grade = $grades[$question->id];