From 14c46e24a91d3ab8d718e3ff3b38214151193cc9 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 20 Jun 2012 13:11:19 +0800 Subject: [PATCH] MDL-33878: Assignment - prevent error when removing overridden flag in gradebook This error only occurs when there is a submission but no grade in the assignment and the feedback comments plugin is enabled. --- mod/assign/locallib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index a7466d13064..df4e4a2c19e 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -3349,8 +3349,10 @@ class assign { // now get the feedback if ($gradebookplugin) { $grade = $this->get_user_grade($result->userid, false); - $gradebookgrade->feedbacktext = $gradebookplugin->text_for_gradebook($grade); - $gradebookgrade->feedbackformat = $gradebookplugin->format_for_gradebook($grade); + if ($grade) { + $gradebookgrade->feedbacktext = $gradebookplugin->text_for_gradebook($grade); + $gradebookgrade->feedbackformat = $gradebookplugin->format_for_gradebook($grade); + } } $grades[$gradebookgrade->userid] = $gradebookgrade; }