From b6f875191f3e8d67786f67e66ce55b332d6095dd Mon Sep 17 00:00:00 2001 From: zumba Date: Tue, 15 Feb 2022 09:20:36 +0200 Subject: [PATCH] Handle missing license when showing license summary Fixes the issue of license summary command aborting when a package is missing license information. --- src/Composer/Command/LicensesCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Command/LicensesCommand.php b/src/Composer/Command/LicensesCommand.php index 5375ab08dcfc..f25a1a61ed02 100644 --- a/src/Composer/Command/LicensesCommand.php +++ b/src/Composer/Command/LicensesCommand.php @@ -125,7 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $usedLicenses = array(); foreach ($packages as $package) { $license = $package instanceof CompletePackageInterface ? $package->getLicense() : array(); - $licenseName = $license[0]; + $licenseName = $license[0] ?? 'none'; if (!isset($usedLicenses[$licenseName])) { $usedLicenses[$licenseName] = 0; }