Skip to content

Commit

Permalink
MDL-65605 mod_lesson: Fix the issue when get_draft_files returns null
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed May 20, 2019
1 parent 89722fc commit f29ba32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mod/lesson/import_form.php
Expand Up @@ -59,6 +59,7 @@ public function definition() {
* @param array $data the submitted data.
* @param array $errors the errors so far.
* @return array the updated errors.
* @throws moodle_exception
*/
protected function validate_uploaded_file($data, $errors) {
global $CFG;
Expand All @@ -69,7 +70,7 @@ protected function validate_uploaded_file($data, $errors) {
}

$files = $this->get_draft_files('questionfile');
if (count($files) < 1) {
if (!is_array($files) || count($files) < 1) {
$errors['questionfile'] = get_string('required');
return $errors;
}
Expand Down

0 comments on commit f29ba32

Please sign in to comment.