From 4478c6a4b7e0bc35211d4ab7c681d5d36563c274 Mon Sep 17 00:00:00 2001 From: Jelle Besseling Date: Thu, 8 Aug 2019 12:48:51 +0200 Subject: Ignore scroll command when msgstore is nil Fixes ~sircmpwn/aerc2#205. Many functions do a nil check on the store, so this changes Store() so it returns nil when msglist is nil. It also places the Scroll() behind the nil check in the next-message command. https://todo.sr.ht/~sircmpwn/aerc2/205 --- commands/account/next.go | 4 ++-- widgets/account.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/commands/account/next.go b/commands/account/next.go index 7b1f230..1ba4b1b 100644 --- a/commands/account/next.go +++ b/commands/account/next.go @@ -65,14 +65,14 @@ func ExecuteNextPrevMessage(args []string, acct *widgets.AccountView, pct bool, store := acct.Store() if store != nil { store.NextPrev(-n) + acct.Messages().Scroll() } - acct.Messages().Scroll() } else { store := acct.Store() if store != nil { store.NextPrev(n) + acct.Messages().Scroll() } - acct.Messages().Scroll() } return nil } diff --git a/widgets/account.go b/widgets/account.go index 07b5010..688b660 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -164,6 +164,9 @@ func (acct *AccountView) Messages() *MessageList { } func (acct *AccountView) Store() *lib.MessageStore { + if acct.msglist == nil { + return nil + } return acct.msglist.Store() } -- cgit v1.2.3