@@ -224,23 +224,20 @@ function processUploadId($uploadId)
224
224
}
225
225
$ this ->licenseMap = new LicenseMap ($ this ->dbManager , $ this ->groupId , LicenseMap::REPORT , true );
226
226
$ this ->computeUri ($ uploadId );
227
-
228
227
$ docLicense = $ this ->licenseDao ->getLicenseByShortName (self ::DATA_LICENSE );
229
228
$ docLicenseId = $ docLicense ->getId () . "- " . md5 ($ docLicense ->getText ());
230
229
$ this ->licensesInDocument [$ docLicenseId ] = (new SpdxLicenseInfo ())
231
230
->setLicenseObj ($ docLicense )
232
231
->setListedLicense (true )
233
232
->setCustomText (false )
234
233
->setTextPrinted (true );
235
-
236
234
$ packageNodes = $ this ->renderPackage ($ uploadId );
237
235
$ additionalUploadIds = array_key_exists (self ::UPLOAD_ADDS ,$ args ) ? explode (', ' ,$ args [self ::UPLOAD_ADDS ]) : array ();
238
236
$ packageIds = array ($ uploadId );
239
237
foreach ($ additionalUploadIds as $ additionalId ) {
240
238
$ packageNodes .= $ this ->renderPackage ($ additionalId );
241
239
$ packageIds [] = $ additionalId ;
242
240
}
243
-
244
241
$ this ->writeReport ($ packageNodes , $ packageIds , $ uploadId );
245
242
return true ;
246
243
}
@@ -384,6 +381,12 @@ protected function renderPackage($uploadId)
384
381
foreach ($ mainLicenseIds as $ licId ) {
385
382
$ reportedLicenseId = $ this ->licenseMap ->getProjectedId ($ licId );
386
383
$ mainLicense = $ this ->licenseDao ->getLicenseById ($ reportedLicenseId , $ this ->groupId );
384
+ if ($ mainLicense === null ) {
385
+ error_log (
386
+ "spdx: Error: main license ID {$ reportedLicenseId } not found; skipping. "
387
+ );
388
+ exit ;
389
+ }
387
390
$ reportLicId = $ mainLicense ->getId () . "- " . md5 ($ mainLicense ->getText ());
388
391
$ mainLicenses [] = $ reportLicId ;
389
392
if (!array_key_exists ($ reportLicId , $ this ->licensesInDocument )) {
0 commit comments