Skip to content

Commit 34175bd

Browse files
committed
fix(spdx): Handle missing linkage types for orphaned graph fragments
Use safe lookup for dependency edges that may not be in the linkage map. Signed-off-by: Kai Hodžić <hodzic.e.k@outlook.com>
1 parent 5ddb211 commit 34175bd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

plugins/reporters/spdx/src/main/kotlin/SpdxDocumentModelMapper.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ internal object SpdxDocumentModelMapper {
7171
relatedSpdxElement = toOrtId.toSpdxId()
7272
)
7373

74-
linkageTypesForDependencyRelationships.getValue(fromOrtId to toOrtId)
75-
.mapTo(mutableSetOf()) { it.toSpdxRelationshipType() }
76-
.sorted()
77-
.forEach { relationshipType ->
74+
linkageTypesForDependencyRelationships[fromOrtId to toOrtId]
75+
?.mapTo(mutableSetOf()) { it.toSpdxRelationshipType() }
76+
?.sorted()
77+
?.forEach { relationshipType ->
7878
relationships += SpdxRelationship(
7979
spdxElementId = fromSpdxId,
8080
relationshipType = relationshipType,

0 commit comments

Comments
 (0)