diff --git a/commands/util.go b/commands/util.go index ffc5ed6..f3f9bc8 100644 --- a/commands/util.go +++ b/commands/util.go @@ -188,6 +188,9 @@ func MsgInfoFromUids(store *lib.MessageStore, uids []uint32) ([]*models.MessageI if !ok { return nil, fmt.Errorf("uid not found") } + if infos[i] == nil { + return nil, fmt.Errorf("message store not ready yet") + } } return infos, nil } diff --git a/lib/msgstore.go b/lib/msgstore.go index 40720b4..051a7d2 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -523,6 +523,13 @@ func (store *MessageStore) updateVisual() { for _, uid := range visUids { store.marked[uid] = struct{}{} } + missing := make([]uint32, 0) + for _, uid := range visUids { + if msg, _ := store.Messages[uid]; msg == nil { + missing = append(missing, uid) + } + } + store.FetchHeaders(missing, nil) } func (store *MessageStore) NextPrev(delta int) {