diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 8f487a26b0c..f9667aadea0 100644 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -121,7 +121,7 @@ function scorm_add_instance($scorm, $mform=null) { // Store the package and verify. if ($record->scormtype === SCORM_TYPE_LOCAL) { - if ($data = $mform->get_data()) { + if ($mform && $data = $mform->get_data()) { $fs = get_file_storage(); $fs->delete_area_files($context->id, 'mod_scorm', 'package'); file_save_draft_area_files($data->packagefile, $context->id, 'mod_scorm', 'package', @@ -197,7 +197,7 @@ function scorm_update_instance($scorm, $mform=null) { $context = context_module::instance($cmid); if ($scorm->scormtype === SCORM_TYPE_LOCAL) { - if ($data = $mform->get_data()) { + if ($mform && $data = $mform->get_data()) { $fs = get_file_storage(); $fs->delete_area_files($context->id, 'mod_scorm', 'package'); file_save_draft_area_files($data->packagefile, $context->id, 'mod_scorm', 'package',