1
0
mirror of https://git.sr.ht/~sircmpwn/aerc synced 2024-11-23 16:42:07 +01:00

Insert nil check before handling prev/next message

If these are called before the store is setup, `acct.Store()` returns
`nil`, and we SEGFAULT in `MessageStore.nextPrev`.
This commit is contained in:
Martin Hafskjold Thoresen 2019-06-18 00:32:57 +02:00 committed by Drew DeVault
parent 74af57b6c6
commit 53df15ae06

@ -48,10 +48,16 @@ func NextPrevMessage(aerc *widgets.Aerc, args []string) error {
}
for ; n > 0; n-- {
if args[0] == "prev-message" || args[0] == "prev" {
acct.Store().Prev()
store := acct.Store()
if store != nil {
store.Prev()
}
acct.Messages().Scroll()
} else {
acct.Store().Next()
store := acct.Store()
if store != nil {
store.Next()
}
acct.Messages().Scroll()
}
}