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:
parent
74af57b6c6
commit
53df15ae06
1 changed files with 8 additions and 2 deletions
|
@ -48,10 +48,16 @@ func NextPrevMessage(aerc *widgets.Aerc, args []string) error {
|
||||||
}
|
}
|
||||||
for ; n > 0; n-- {
|
for ; n > 0; n-- {
|
||||||
if args[0] == "prev-message" || args[0] == "prev" {
|
if args[0] == "prev-message" || args[0] == "prev" {
|
||||||
acct.Store().Prev()
|
store := acct.Store()
|
||||||
|
if store != nil {
|
||||||
|
store.Prev()
|
||||||
|
}
|
||||||
acct.Messages().Scroll()
|
acct.Messages().Scroll()
|
||||||
} else {
|
} else {
|
||||||
acct.Store().Next()
|
store := acct.Store()
|
||||||
|
if store != nil {
|
||||||
|
store.Next()
|
||||||
|
}
|
||||||
acct.Messages().Scroll()
|
acct.Messages().Scroll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue