From 61367e6417dbcac2c1daa58ef3ee96eea20e09ba Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 24 Apr 2003 17:13:52 +0000 Subject: [PATCH] More robust variable checking --- mod/quiz/lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 5016acb12e..5c108b46aa 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -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]; -- 2.39.5