aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-02-03 00:13:19 +0100
committerRobin Jarry <robin@jarry.cc>2023-02-20 14:40:29 +0100
commit28483808727fd288b95b9dd26a716f6cf7c02b5a (patch)
treecc5661d406c4717ec5a3c693af815f847bdfbe8e /widgets
parent4ef76f0a95fc1aba7d92fd1a84308286280856e7 (diff)
downloadaerc-28483808727fd288b95b9dd26a716f6cf7c02b5a.tar.gz
account: fix segfault when message store is not initialized
Fix the following error: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x130 pc=0x8769b4] goroutine 1 [running]: git.sr.ht/~rjarry/aerc/lib.(*MessageStore).Uids(0x40ffa5?) git.sr.ht/~rjarry/aerc/lib/msgstore.go:579 +0x14 git.sr.ht/~rjarry/aerc/widgets.(*AccountView).SelectedMessage(0xc0000f41c0) git.sr.ht/~rjarry/aerc/widgets/account.go:198 +0x33 Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/account.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/widgets/account.go b/widgets/account.go
index 6c9ab3eb..85043d1f 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -198,6 +198,9 @@ func (acct *AccountView) SelectedDirectory() string {
}
func (acct *AccountView) SelectedMessage() (*models.MessageInfo, error) {
+ if acct.msglist == nil || acct.msglist.Store() == nil {
+ return nil, errors.New("init in progress")
+ }
if len(acct.msglist.Store().Uids()) == 0 {
return nil, errors.New("no message selected")
}