From f8b665224f2e643bf0d81583110e4e2c68ae7788 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 26 Jul 2012 10:07:09 +0100 Subject: [PATCH] MDL-34532 quiz reports: error when showing users without attempts. We were not checking if attempt state was null before trying to convert it to a string. --- mod/quiz/report/attemptsreport_table.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/quiz/report/attemptsreport_table.php b/mod/quiz/report/attemptsreport_table.php index 4334256eb18c6..f119da0b8a4d9 100644 --- a/mod/quiz/report/attemptsreport_table.php +++ b/mod/quiz/report/attemptsreport_table.php @@ -152,7 +152,11 @@ public function col_fullname($attempt) { * @return string HTML content to go inside the td. */ public function col_state($attempt) { - return quiz_attempt::state_name($attempt->state); + if (!is_null($attempt->attempt)) { + return quiz_attempt::state_name($attempt->state); + } else { + return '-'; + } } /**