X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=sidebar.c;h=ebc1a64d63309b9c280de575501fc6ea151f35b7;hb=ba1dcc133bb083b29ec620ff9559d923242c628c;hp=5089989621c0390e74947aa1db4831d1396c6378;hpb=cc3d47bfac671f147aa0822cd5ecdc84e91de979;p=apps%2Fmadmutt.git diff --git a/sidebar.c b/sidebar.c index 5089989..ebc1a64 100644 --- a/sidebar.c +++ b/sidebar.c @@ -207,6 +207,8 @@ void set_curbuffy(char buf[LONG_STRING]) void set_buffystats (CONTEXT* Context) { BUFFY* tmp = Incoming; + if (!Context) + return; while (tmp) { if (strcmp (tmp->path, Context->path) == 0) @@ -330,9 +332,10 @@ BUFFY * exist_prev_new() void scroll_sidebar(int op, int menu) { - if(!SidebarWidth) return; - if(!CurBuffy) return; - BUFFY *tmp; + BUFFY *tmp; + + if(!SidebarWidth) return; + if(!CurBuffy) return; switch (op) { case OP_SIDEBAR_NEXT: @@ -341,10 +344,7 @@ void scroll_sidebar(int op, int menu) break; case OP_SIDEBAR_NEXT_NEW: if ( (tmp = exist_next_new()) == NULL) - { - if (CurBuffy->next == NULL) return; - CurBuffy = CurBuffy->next; - } + return; else CurBuffy = tmp; break; case OP_SIDEBAR_PREV: @@ -353,10 +353,7 @@ void scroll_sidebar(int op, int menu) break; case OP_SIDEBAR_PREV_NEW: if ( (tmp = exist_prev_new()) == NULL) - { - if(CurBuffy->prev == NULL) return; - CurBuffy = CurBuffy->prev; - } + return; else CurBuffy = tmp; break;