msgstore: fetch missing headers in visual mode
fetches missing headers when in visual selection mode. This prevents large archive operations from panicking due to a nil pointer dereference. The archive command will return an error to the ui when a nil message is encountered to signal that the message store is not ready yet. Signed-off-by: Koni Marti <koni.marti@gmail.com>
This commit is contained in:
parent
44f81c87e4
commit
e5ad877af5
2 changed files with 10 additions and 0 deletions
|
@ -188,6 +188,9 @@ func MsgInfoFromUids(store *lib.MessageStore, uids []uint32) ([]*models.MessageI
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("uid not found")
|
return nil, fmt.Errorf("uid not found")
|
||||||
}
|
}
|
||||||
|
if infos[i] == nil {
|
||||||
|
return nil, fmt.Errorf("message store not ready yet")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return infos, nil
|
return infos, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,6 +523,13 @@ func (store *MessageStore) updateVisual() {
|
||||||
for _, uid := range visUids {
|
for _, uid := range visUids {
|
||||||
store.marked[uid] = struct{}{}
|
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) {
|
func (store *MessageStore) NextPrev(delta int) {
|
||||||
|
|
Loading…
Reference in a new issue