From 939fdef91365ae2a6b119cd3aaffc3405bdbcf4d Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Fri, 5 Jun 2020 14:42:15 -0400 Subject: [PATCH] Fix panic when deleting item at end of stash --- ui/stash.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/stash.go b/ui/stash.go index 9bad91d..a4e476a 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -132,7 +132,7 @@ func (m stashModel) markdownIndex() int { // return the current selected markdown in the stash func (m stashModel) selectedMarkdown() *markdown { - if len(m.markdowns) == 0 { + if len(m.markdowns) == 0 || len(m.markdowns) <= m.markdownIndex() { return nil } return m.markdowns[m.markdownIndex()]