diff --git a/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt b/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt index 6102553300dda..51b2eb2488bb3 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() + } } }