mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-65605 core_question: Fix the issue when get_draft_files returns nul
This commit is contained in:
parent
a9d62c4513
commit
c7ac83ca0a
@ -112,6 +112,7 @@ class question_import_form extends moodleform {
|
||||
* @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) {
|
||||
if (empty($data['newfile'])) {
|
||||
@ -120,7 +121,7 @@ class question_import_form extends moodleform {
|
||||
}
|
||||
|
||||
$files = $this->get_draft_files('newfile');
|
||||
if (count($files) < 1) {
|
||||
if (!is_array($files) || count($files) < 1) {
|
||||
$errors['newfile'] = get_string('required');
|
||||
return $errors;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user