1
0
mirror of https://github.com/securego/gosec.git synced 2025-11-29 22:37:59 +02:00

fix: make sure that nil Cwe pointer is handled when getting the CWE ID

This commit is contained in:
Cosmin Cojocar
2022-08-20 13:20:36 +02:00
parent 62fa4b4e9b
commit 19fa856bad
4 changed files with 22 additions and 9 deletions

View File

@@ -19,7 +19,11 @@ func (w *Weakness) SprintURL() string {
// SprintID format the CWE ID
func (w *Weakness) SprintID() string {
return fmt.Sprintf("%s-%s", Acronym, w.ID)
id := "0000"
if w != nil {
id = w.ID
}
return fmt.Sprintf("%s-%s", Acronym, id)
}
// MarshalJSON print only id and URL