Skip to content

Commit

Permalink
Handle missing license when showing license summary
Browse files Browse the repository at this point in the history
Fixes the issue of license summary command aborting when a package is
missing license information.
  • Loading branch information
gzumba committed Feb 15, 2022
1 parent 23b0a38 commit 9327a3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Composer/Command/LicensesCommand.php
Expand Up @@ -125,7 +125,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$usedLicenses = array();
foreach ($packages as $package) {
$license = $package instanceof CompletePackageInterface ? $package->getLicense() : array();
$licenseName = $license[0];
$licenseName = array_key_exists(0, $license) ? $license[0] : 'none';

if (!isset($usedLicenses[$licenseName])) {
$usedLicenses[$licenseName] = 0;
}
Expand Down

0 comments on commit 9327a3e

Please sign in to comment.