From 0d77853912736c44133f33ad5589a1b9265442ba Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Wed, 14 Sep 2016 12:01:17 +0900 Subject: [PATCH] Fix a error when no json dirs are found under results #180 --- report/tui.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/report/tui.go b/report/tui.go index a1aca832ae..6804d35f77 100644 --- a/report/tui.go +++ b/report/tui.go @@ -79,6 +79,9 @@ func selectScanHistory(jsonDirName string) (latest models.ScanHistory, err error if jsonDirs, err = GetValidJSONDirs(); err != nil { return } + if len(jsonDirs) == 0 { + return latest, fmt.Errorf("No scan results are found in %s", config.Conf.JSONBaseDir) + } jsonDir = jsonDirs[0] } if latest, err = LoadOneScanHistory(jsonDir); err != nil {