From 31ae5d74ad1145545048c74fcabb61d9fc7329e9 Mon Sep 17 00:00:00 2001 From: kevin olson Date: Wed, 15 May 2024 17:10:30 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=BA=20make=20sure=20nil=20never=20happ?= =?UTF-8?q?ens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cmd/scan/scan.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cmd/scan/scan.go b/pkg/cmd/scan/scan.go index 3cfbc39..453f3ec 100644 --- a/pkg/cmd/scan/scan.go +++ b/pkg/cmd/scan/scan.go @@ -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 @@ -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))) }