MDL-67800 contenttype_h5p: Fix the error when deleting a content with no file
authorAmaia Anabitarte <amaia@moodle.com>
Fri, 1 May 2020 14:36:03 +0000 (16:36 +0200)
committerAmaia Anabitarte <amaia@moodle.com>
Tue, 5 May 2020 08:19:15 +0000 (10:19 +0200)
contentbank/contenttype/h5p/classes/contenttype.php

index f28bee8..076ec99 100644 (file)
@@ -45,7 +45,9 @@ class contenttype extends \core_contentbank\contenttype {
     public function delete_content(\core_contentbank\content $content): bool {
         // Delete the H5P content.
         $factory = new \core_h5p\factory();
-        \core_h5p\api::delete_content_from_pluginfile_url($content->get_file_url(), $factory);
+        if (!empty($content->get_file_url())) {
+            \core_h5p\api::delete_content_from_pluginfile_url($content->get_file_url(), $factory);
+        }
 
         // Delete the content from the content_bank.
         return parent::delete_content($content);