diff --git a/convert.go b/convert.go index 7dbecb4..3124ce7 100644 --- a/convert.go +++ b/convert.go @@ -195,13 +195,15 @@ func convertEvidence(c *Component, specVersion SpecVersion) { } if specVersion < SpecVersion1_6 { - for i := range *c.Evidence.Occurrences { - occ := &(*c.Evidence.Occurrences)[i] - - occ.Line = nil - occ.Offset = nil - occ.Symbol = "" - occ.AdditionalContext = "" + if c.Evidence.Occurrences != nil { + for i := range *c.Evidence.Occurrences { + occ := &(*c.Evidence.Occurrences)[i] + + occ.Line = nil + occ.Offset = nil + occ.Symbol = "" + occ.AdditionalContext = "" + } } } diff --git a/validate_json_test.go b/validate_json_test.go index 6269759..eb1a66e 100644 --- a/validate_json_test.go +++ b/validate_json_test.go @@ -18,6 +18,7 @@ package cyclonedx import ( + "errors" "fmt" "github.com/xeipuuv/gojsonschema" @@ -60,5 +61,5 @@ func (jv jsonValidator) Validate(bom []byte, specVersion SpecVersion) error { errSummary += fmt.Sprintf("\n - %s", verr.String()) } - return fmt.Errorf(errSummary) + return errors.New(errSummary) }