diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 71dd83f53..6d7311dd4 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -400,7 +400,7 @@ EOT $license ); $spdx = new SpdxLicenses(); - if (!$spdx->validate($license) && $license !== 'proprietary') { + if (null !== $license && !$spdx->validate($license) && $license !== 'proprietary') { throw new \InvalidArgumentException('Invalid license provided: '.$license.'. Only SPDX license identifiers (https://spdx.org/licenses/) or "proprietary" are accepted.'); } $input->setOption('license', $license);