diff --git a/h5p/classes/core.php b/h5p/classes/core.php index ec4150326bf..1a60d55a1e9 100644 --- a/h5p/classes/core.php +++ b/h5p/classes/core.php @@ -277,7 +277,13 @@ class core extends H5PCore { $file->delete(); $librarykey = static::libraryToString($library); - $libraryid = $factory->get_storage()->h5pC->librariesJsonData[$librarykey]["libraryId"]; + + $libraryjson = $factory->get_storage()->h5pC->librariesJsonData[$librarykey]; + if (!array_key_exists('libraryId', $libraryjson)) { + return null; + } + + $libraryid = $libraryjson['libraryId']; // Update example and tutorial (if any of them are defined in $library). $params = ['id' => $libraryid];