Skip to content

Commit 24a4cf0

Browse files
committed
MDL-58001 mod_assign: Catch exception if grade item cannot be loaded
1 parent b4a8c83 commit 24a4cf0

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

mod/assign/locallib.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8697,8 +8697,12 @@ protected function reopen_submission_if_required($userid, $submission, $addattem
86978697
break;
86988698
case ASSIGN_ATTEMPT_REOPEN_METHOD_UNTILPASS:
86998699
// Check the gradetopass from the gradebook.
8700-
$gradeitem = $this->get_grade_item();
8701-
if ($gradeitem) {
8700+
try {
8701+
$gradeitem = $this->get_grade_item();
8702+
} catch (coding_exception $e) {
8703+
debugging($e->getMessage(), DEBUG_DEVELOPER);
8704+
}
8705+
if (!empty($gradeitem)) {
87028706
$gradegrade = grade_grade::fetch(['userid' => $userid, 'itemid' => $gradeitem->id]);
87038707

87048708
// Do not reopen if is_passed returns null, e.g. if there is no pass criterion set.

0 commit comments

Comments
 (0)