Skip to content

Commit

Permalink
Merge pull request #32 from vulncheck-oss/avoid-scan-panic
Browse files Browse the repository at this point in the history
🩺 make sure nil never happens
  • Loading branch information
acidjazz authored May 15, 2024
2 parents 5e575bb + 31ae5d7 commit fbffdbc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/cmd/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ func Command() *cobra.Command {
if err != nil {
return err
}
vulns = results
if results != nil {
vulns = results
} else {
vulns = &[]models.ScanResultVulnerabilities{}
}

t.Title = fmt.Sprintf(i18n.C.ScanScanPurlEnd, len(*vulns))
return nil
Expand Down Expand Up @@ -126,10 +130,6 @@ func Command() *cobra.Command {
return err
}

if vulns == nil {
ui.Info(fmt.Sprintf(i18n.C.ScanNoCvesFound, len(purls)))
}

if len(*vulns) == 0 {
ui.Info(fmt.Sprintf(i18n.C.ScanNoCvesFound, len(purls)))
}
Expand Down

0 comments on commit fbffdbc

Please sign in to comment.