about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorRafael Castillo <rafael@trfs.me>2019-12-04 15:46:34 -0700
committerDrew DeVault <sir@cmpwn.com>2019-12-07 14:29:36 -0500
commit74c13e84b74804f5fc5f2e37d4c9f1af57fc1403 (patch)
tree130742342030fc1df3dba9a9a1cafdffd6c0edd2
parenteef662c60677355b47b8903c619b742c1a91d3d6 (diff)
downloadaerc-74c13e84b74804f5fc5f2e37d4c9f1af57fc1403.tar.gz
Initialize an empty message map in the message store on initialization
This addresses occasional crashes when a `MessageInfo` event reached the message
store before `DirectoryContents`, particularly on slower (imap) accounts.
-rw-r--r--lib/msgstore.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 56d9eda..434e0ad 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -46,8 +46,9 @@ func NewMessageStore(worker *types.Worker,
 	triggerDirectoryChange func()) *MessageStore {
 
 	return &MessageStore{
-		Deleted: make(map[uint32]interface{}),
-		DirInfo: *dirInfo,
+		Deleted:  make(map[uint32]interface{}),
+		DirInfo:  *dirInfo,
+		Messages: make(map[uint32]*models.MessageInfo),
 
 		selected:        0,
 		bodyCallbacks:   make(map[uint32][]func(io.Reader)),