From 53df15ae06214b2c2e4aa176f125093334c8c0f9 Mon Sep 17 00:00:00 2001 From: Martin Hafskjold Thoresen Date: Tue, 18 Jun 2019 00:32:57 +0200 Subject: 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`. --- commands/account/next.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'commands/account') 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() } } -- cgit v1.2.3