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 b6f8751
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Composer/Command/LicensesCommand.php
Expand Up @@ -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;
}
Expand Down

0 comments on commit b6f8751

Please sign in to comment.