Validate package instance before checking execution policy

This commit is contained in:
netkas 2024-10-25 19:59:22 -04:00
parent 41947069be
commit 544d4ebdf6
2 changed files with 9 additions and 6 deletions

View file

@ -94,14 +94,14 @@
throw new InvalidArgumentException(sprintf('Package %s is not imported', $package));
}
if(self::$imported_packages[$package]?->getMetadata()?->getMainExecutionPolicy() === null)
{
Console::out('The package does not have a main execution policy, skipping execution');
return 0;
}
if(self::$imported_packages[$package] instanceof PackageReader)
{
if(self::$imported_packages[$package]?->getMetadata()?->getMainExecutionPolicy() === null)
{
Console::out('The package does not have a main execution policy, skipping execution');
return 0;
}
return ExecutionUnitRunner::executeFromPackage(
self::$imported_packages[$package],
self::$imported_packages[$package]->getMetadata()->getMainExecutionPolicy()