]> granicus.if.org Git - neomutt/commitdiff
Fix crash when trying to collapse a limit not matching any messages
authorPietro Cerutti <gahr@gahr.ch>
Thu, 2 May 2019 12:42:29 +0000 (12:42 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 2 May 2019 12:52:59 +0000 (13:52 +0100)
This is a follow-up of #1685

index.c

diff --git a/index.c b/index.c
index 52206efbd8a408cfa9fbd4a6e693a03fa0b76264..1ab37ae0e4d7663de205d63816a478a5e2d0d749 100644 (file)
--- a/index.c
+++ b/index.c
@@ -254,6 +254,9 @@ static void collapse_all(struct Menu *menu, int toggle)
   else
     final = CUR_EMAIL->virtual;
 
+  if (final == -1)
+    return;
+
   base = Context->mailbox->emails[Context->mailbox->v2r[final]];
 
   /* Iterate all threads, perform collapse/uncollapse as needed */