From 74c13e84b74804f5fc5f2e37d4c9f1af57fc1403 Mon Sep 17 00:00:00 2001 From: Rafael Castillo Date: Wed, 4 Dec 2019 15:46:34 -0700 Subject: 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. --- lib/msgstore.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/msgstore.go') 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)), -- cgit 1.4.1-2-gfad0