]> granicus.if.org Git - mutt/commitdiff
Try to fix a segmentation fault in the index.
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 25 Jul 2000 08:02:12 +0000 (08:02 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 25 Jul 2000 08:02:12 +0000 (08:02 +0000)
curs_main.c

index b92429ac432f4b0c508e0120537d7b4b1296d5d0..a09724de9d741d41d9f564fef4dfd9d39b0b064f 100644 (file)
@@ -434,8 +434,8 @@ int mutt_index_menu (void)
 #ifdef USE_IMAP
       imap_allow_reopen (Context);
 #endif
-      
-      index_hint = (Context->vcount) ? CURHDR->index : 0;
+    
+      index_hint = (Context->vcount && menu->current < Context->vcount) ? CURHDR->index : 0;
 
       if ((check = mx_check_mailbox (Context, &index_hint, 0)) < 0)
       {
@@ -527,7 +527,10 @@ int mutt_index_menu (void)
       }
 
       menu->redraw = 0;
-      menu->oldcurrent = menu->current;
+      if (menu->current < menu->max)
+       menu->oldcurrent = menu->current;
+      else
+       menu->oldcurrent = -1;
 
       if (option (OPTARROWCURSOR))
        move (menu->current - menu->top + menu->offset, 2);
@@ -738,7 +741,8 @@ int mutt_index_menu (void)
       case OP_MAIN_LIMIT:
 
        CHECK_MSGCOUNT;
-       menu->oldcurrent = Context->vcount ? CURHDR->index : -1;
+       menu->oldcurrent = (Context->vcount && menu->current < Context->vcount) ?
+               CURHDR->index : -1;
        if (mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)
        {
          if (menu->oldcurrent >= 0)