Fix a error when no json dirs are found under results #180

This commit is contained in:
Kota Kanbe
2016-09-14 12:01:17 +09:00
parent ea1b5dd8f7
commit 0d77853912

View File

@@ -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 {