From f6bb6789f6c14776444dd6d942e5a404596c6b68 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Sun, 20 Oct 2019 21:50:21 +0200 Subject: [PATCH] fix: minor change --- gpm/cli.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gpm/cli.go b/gpm/cli.go index 4228438..cf9d2f4 100644 --- a/gpm/cli.go +++ b/gpm/cli.go @@ -143,7 +143,11 @@ func (c *Cli) GroupsBox() string { case "q", "", "": return "" case "": - return l.Rows[l.SelectedRow] + if len(l.Rows) == 0 { + return "" + } else { + return l.Rows[l.SelectedRow] + } case "j", "": if len(l.Rows) > 0 { l.ScrollDown() @@ -292,7 +296,7 @@ func (c *Cli) ListEntries(ch chan<- bool) { ui.Clear() } - if index >= 0 { + if len(entries) > 0 && index >= 0 && index < len(entries) { c.EntryBox(entries[index]) }