Nico Golde:
[apps/madmutt.git] / sidebar.c
index bbc2c60..ebc1a64 100644 (file)
--- 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)
@@ -342,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:
@@ -354,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;