aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-06-24 22:10:57 +0200
committerRobin Jarry <robin@jarry.cc>2024-06-25 00:29:36 +0200
commit37ddad48770fe5e2f98c03bfc4692a59cd6d4a16 (patch)
tree642a7b2a823281334eb0bbac5be736f7cdd04b77
parent3e65bfe58aa510fe4c3efd8db8c3f7d3f0aedbaf (diff)
downloadaerc-37ddad48770fe5e2f98c03bfc4692a59cd6d4a16.tar.gz
next,prev: fix panic when message list is empty
When running :filter -u and iterating over all messages with maildir, the list will eventually become empty (e.g. all messages have been read, no unread messages can be displayed). At this point, :next or :prev will fail to select anything and the maildir backend will return an error. Since the error is not caught, the message viewer is reloaded with a broken message. At this point, any key press causes a panic. This only happens with maildir because message list filters are updated dynamically in the background everytime a filsystem event is triggered. Avoid reloading the message viewer if an error is returned by the backend. Just display the error and abort. Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CD1761AO8LJUL.12698V9VQDR9B@gmail.com%3E Reported-by: Matthew Bystrin <dev.mbstr@gmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
-rw-r--r--commands/account/next.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/commands/account/next.go b/commands/account/next.go
index 4245dd60..e14b14fb 100644
--- a/commands/account/next.go
+++ b/commands/account/next.go
@@ -66,6 +66,10 @@ func (np NextPrevMsg) Execute(args []string) error {
if mv, ok := app.SelectedTabContent().(*app.MessageViewer); ok {
reloadViewer := func(nextMsg *models.MessageInfo) {
+ if nextMsg.Error != nil {
+ app.PushError(nextMsg.Error.Error())
+ return
+ }
lib.NewMessageStoreView(nextMsg, mv.MessageView().SeenFlagSet(),
store, app.CryptoProvider(), app.DecryptKeys,
func(view lib.MessageView, err error) {