From 544d4ebdf689da4b8bf88b1970a03f3a47aeed86 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 25 Oct 2024 19:59:22 -0400 Subject: [PATCH] Validate package instance before checking execution policy --- CHANGELOG.md | 3 +++ src/ncc/Classes/Runtime.php | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a4fcf7..ebd98f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 This update introduces critical bug fixes +### Fixed + - Validate package instance before checking execution policy + ## [2.1.5] - 2024-10-14 diff --git a/src/ncc/Classes/Runtime.php b/src/ncc/Classes/Runtime.php index f1b3722..c7859d1 100644 --- a/src/ncc/Classes/Runtime.php +++ b/src/ncc/Classes/Runtime.php @@ -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()