Fix panic: runtime error: index out of range in tui mode #5

This commit is contained in:
kota kanbe
2016-04-06 12:09:29 +09:00
parent 110d74a91e
commit 76ade4c3b4

View File

@@ -602,7 +602,6 @@ func summaryLines(data models.ScanResult) string {
}
stable.AddRow(icols...)
}
// ignore UnknownCves
return fmt.Sprintf("%s", stable)
}
@@ -625,7 +624,6 @@ func setDetailLayout(g *gocui.Gui) error {
// currentScanResult.KnownCves[currentCveInfo],
// currentScanResult.Family)
//TODO error handling
text, err := detailLines()
if err != nil {
return err
@@ -654,6 +652,10 @@ type dataForTmpl struct {
}
func detailLines() (string, error) {
if len(currentScanResult.KnownCves) == 0 {
return "No vulnerable packages", nil
}
cveInfo := currentScanResult.KnownCves[currentCveInfo]
cveID := cveInfo.CveDetail.CveID