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
This commit is contained in:
Jelle Besseling 2019-08-08 12:48:51 +02:00 committed by Drew DeVault
parent 5b523880b4
commit 4478c6a4b7
2 changed files with 5 additions and 2 deletions

View File

@ -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
}

View File

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