MDL-45933 Assign: Prevent fatal error when there are no users in the grading table
authorDamyon Wiese <damyon@moodle.com>
Wed, 18 Jun 2014 07:17:02 +0000 (15:17 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 18 Jun 2014 07:17:02 +0000 (15:17 +0800)
mod/assign/locallib.php

index 9c323eb..42ad711 100644 (file)
@@ -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;