summary refs log tree commit diff stats
path: root/lib
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 /lib
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.
Diffstat (limited to 'lib')
-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)),
n147' href='#n147'>147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190