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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user