From 1165b7ded74d92b7a77d4cd7859e291480172f27 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 18 Jun 2014 15:17:02 +0800 Subject: [PATCH] MDL-45933 Assign: Prevent fatal error when there are no users in the grading table --- mod/assign/locallib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 9c323ebe3ed..42ad711d946 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -4984,6 +4984,10 @@ class assign { $users[$userid] = $record; } + if (empty($users)) { + return get_string('nousersselected', 'assign'); + } + list($userids, $params) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED); $params['assignid1'] = $this->get_instance()->id; $params['assignid2'] = $this->get_instance()->id;