ScriptPluginLoader: properly handle the case where the script itself is somehow missing

this won't ever happen during PocketMine runtime, but it might happen if something else tries to use it.
This commit is contained in:
Dylan K. Taylor 2020-04-15 12:54:45 +01:00
parent cdda74ef93
commit 0a3788f9ac

View File

@ -55,7 +55,10 @@ class ScriptPluginLoader implements PluginLoader{
* Gets the PluginDescription from the file
*/
public function getPluginDescription(string $file) : ?PluginDescription{
$content = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$content = @file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if($content === false){
return null;
}
$data = [];