Skip to content

Commit

Permalink
Merge pull request #365 from viveksahu26/fix/vulnerability_nil_error
Browse files Browse the repository at this point in the history
fix vuln nil derefernce error
  • Loading branch information
riteshnoronha authored Nov 28, 2024
2 parents 7205fc2 + 270537f commit feb5a53
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/sbom/cdx.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,14 @@ func (c *CdxDoc) parseSpec() {

func (c *CdxDoc) parseVulnerabilities() {
vuln := Vulnerability{}
for _, v := range *c.doc.Vulnerabilities {
if v.ID != "" {
vuln.Id = v.ID
if c.doc.Vulnerabilities != nil {
for _, v := range *c.doc.Vulnerabilities {
if v.ID != "" {
vuln.Id = v.ID
}
}
c.vuln = vuln
}
c.vuln = vuln
}

func (c *CdxDoc) requiredFields() bool {
Expand Down

0 comments on commit feb5a53

Please sign in to comment.