fix: minor change

This commit is contained in:
Adrien Waksberg 2019-10-20 21:50:21 +02:00
parent 4b775101c8
commit f6bb6789f6

View file

@ -143,7 +143,11 @@ func (c *Cli) GroupsBox() string {
case "q", "<C-c>", "<Escape>": case "q", "<C-c>", "<Escape>":
return "" return ""
case "<Enter>": case "<Enter>":
if len(l.Rows) == 0 {
return ""
} else {
return l.Rows[l.SelectedRow] return l.Rows[l.SelectedRow]
}
case "j", "<Down>": case "j", "<Down>":
if len(l.Rows) > 0 { if len(l.Rows) > 0 {
l.ScrollDown() l.ScrollDown()
@ -292,7 +296,7 @@ func (c *Cli) ListEntries(ch chan<- bool) {
ui.Clear() ui.Clear()
} }
if index >= 0 { if len(entries) > 0 && index >= 0 && index < len(entries) {
c.EntryBox(entries[index]) c.EntryBox(entries[index])
} }