<<< Date Index >>>     <<< Thread Index >>>

[PATCH 09 of 16] resort_index will use menu->current as a index into an array



1 file changed, 1 insertion(+), 1 deletion(-)
curs_main.c |    2 +-


# HG changeset patch
# User Erik Hovland <erik@xxxxxxxxxxx>
# Date 1236896205 25200
# Branch HEAD
# Node ID 4c47858b2331ed8fd6d8a03a95e61ae74aa53319
# Parent  11043c209744a060c15ca4db24bc49ae63fd4aea
resort_index will use menu->current as a index into an array.
If menu->current is negative, bad things can happen. So check
it before calling resort_index

diff --git a/curs_main.c b/curs_main.c
--- a/curs_main.c
+++ b/curs_main.c
@@ -452,7 +452,7 @@
      * any 'op' below could do mutt_enter_command(), either here or
      * from any new menu launched, and change $sort/$sort_aux
      */
-    if (option (OPTNEEDRESORT) && Context && Context->msgcount)
+    if (option (OPTNEEDRESORT) && Context && Context->msgcount && 
menu->current >= 0)
       resort_index (menu);
 
     menu->max = Context ? Context->vcount : 0;