Skip to content

Commit

Permalink
fix panic
Browse files Browse the repository at this point in the history
  • Loading branch information
houdini91 committed May 1, 2023
1 parent f650933 commit 653499f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions syft/formats/common/cyclonedxhelpers/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ func GetValidator(format cyclonedx.BOMFileFormat) sbom.Validator {
return err
}

if bom.Components != nil {
if bom.Components != nil &&
bom.Metadata != nil &&
bom.Metadata.Component != nil {
components := *bom.Components
components = append(components, *bom.Metadata.Component)
bom.Components = &components
Expand All @@ -48,7 +50,9 @@ func GetDecoder(format cyclonedx.BOMFileFormat) sbom.Decoder {
if err != nil {
return nil, err
}
if bom.Components != nil {
if bom.Components != nil &&
bom.Metadata != nil &&
bom.Metadata.Component != nil {
components := *bom.Components
components = append(components, *bom.Metadata.Component)
bom.Components = &components
Expand Down

0 comments on commit 653499f

Please sign in to comment.