From 5e63c8e57e73575a4ccd08cb1f5763cb0d369f2e 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 c1d173a5c23..bbf443eaedf 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -4982,6 +4982,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;