From f37d51abdebd46f94bc3e47e12cb775b07b88a31 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Tue, 25 Jul 2000 08:02:12 +0000 Subject: [PATCH] Try to fix a segmentation fault in the index. --- curs_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/curs_main.c b/curs_main.c index b92429ac4..a09724de9 100644 --- a/curs_main.c +++ b/curs_main.c @@ -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) -- 2.40.0