diff --git a/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt b/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt index 2703eff0a1431..5fc34ee3b3b37 100644 --- a/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt +++ b/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt @@ -406,13 +406,15 @@ private fun generateBom(bom: Bom, schemaVersion: Version, fileExtension: String) // Clear the "dependencyType". component.extensibleTypes = null - component.licenses.licenses.forEach { license -> - // Clear the "origin". - license.extensibleTypes = null - } + if (component.licenses?.licenses != null) { + component.licenses.licenses.forEach { license -> + // Clear the "origin". + license.extensibleTypes = null + } - // Remove duplicates that may occur due to clearing the distinguishing extensive type. - component.licenses.licenses = component.licenses.licenses.distinct() + // Remove duplicates that may occur due to clearing the distinguishing extensive type. + component.licenses.licenses = component.licenses.licenses.distinct() + } } }