Fix panic when deleting item at end of stash

This commit is contained in:
Christian Rocha 2020-06-05 14:42:15 -04:00 committed by Christian Muehlhaeuser
commit 939fdef913

View file

@ -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()]