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.
This commit is contained in:
Rafael Castillo 2019-12-04 15:46:34 -07:00 committed by Drew DeVault
parent eef662c606
commit 74c13e84b7

View file

@ -48,6 +48,7 @@ func NewMessageStore(worker *types.Worker,
return &MessageStore{ return &MessageStore{
Deleted: make(map[uint32]interface{}), Deleted: make(map[uint32]interface{}),
DirInfo: *dirInfo, DirInfo: *dirInfo,
Messages: make(map[uint32]*models.MessageInfo),
selected: 0, selected: 0,
bodyCallbacks: make(map[uint32][]func(io.Reader)), bodyCallbacks: make(map[uint32][]func(io.Reader)),