aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-01-22 14:54:11 +0100
committerRobin Jarry <robin@jarry.cc>2022-01-22 17:07:50 +0100
commite5ad877af5629d8b29350bb9ff476afaa92a3c49 (patch)
tree187de02e690b07d98754fe7f407a6b3e165ccd83 /lib
parent44f81c87e47f80d7f29018ac0f7254dbb233e429 (diff)
downloadaerc-e5ad877af5629d8b29350bb9ff476afaa92a3c49.tar.gz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/msgstore.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 40720b46..051a7d2c 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) {