[PATCH aerc] msgstore: fetch missing headers in visual mode
Export this patch
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>
Thanks!
To git.sr.ht:~rjarry/aerc
44f81c87e47f..e5ad877af562 master -> master
---
commands/util.go | 3 +++
lib/msgstore.go | 7 +++++++
2 files changed, 10 insertions(+)
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) {
--
2.34.1
aerc/patches: SUCCESS in 3m49s
[msgstore: fetch missing headers in visual mode][0] from [Koni Marti][1]
[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/28621
[1]: mailto:koni.marti@gmail.com
✓ #677910 SUCCESS aerc/patches/fedora-latest.yml https://builds.sr.ht/~rjarry/job/677910
✓ #677908 SUCCESS aerc/patches/archlinux.yml https://builds.sr.ht/~rjarry/job/677908
✓ #677909 SUCCESS aerc/patches/debian-stable.yml https://builds.sr.ht/~rjarry/job/677909
✓ #677907 SUCCESS aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/677907
Koni Marti, Jan 22, 2022 at 14:54: