summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Hafskjold Thoresen <git@mht.wtf>2019-06-18 00:32:57 +0200
committerDrew DeVault <sir@cmpwn.com>2019-06-18 19:39:42 -0400
commit53df15ae06214b2c2e4aa176f125093334c8c0f9 (patch)
tree467eda5ee92bb2074ca03a3dd35c1c458f18cdbb
parent74af57b6c617382ed0e8cd79626cac98ffc2e549 (diff)
downloadaerc-53df15ae06214b2c2e4aa176f125093334c8c0f9.zip
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`.
-rw-r--r--commands/account/next.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/commands/account/next.go b/commands/account/next.go
index 88c4fd4..3b9260c 100644
--- a/commands/account/next.go
+++ b/commands/account/next.go
@@ -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()
}
}