]> granicus.if.org Git - neomutt/commitdiff
coverity: add variable - Context could become NULL
authorRichard Russon <rich@flatcap.org>
Mon, 10 Apr 2017 12:51:55 +0000 (13:51 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 10 Apr 2017 13:32:04 +0000 (14:32 +0100)
curs_main.c

index 9b5138790307d4b889f9853ce6293e03e6a28826..8a88df2bc2967535040b4b3d2235bbe49c5097c7 100644 (file)
@@ -1658,9 +1658,11 @@ int mutt_index_menu (void)
        break;
 
       case OP_COMPOSE_TO_SENDER:
-
-       mutt_compose_to_sender (tag ? NULL : CURHDR);
-       menu->redraw = REDRAW_FULL;
+        if (Context)
+        {
+          mutt_compose_to_sender (tag ? NULL : CURHDR);
+          menu->redraw = REDRAW_FULL;
+        }
        break;
 
        /* --------------------------------------------------------------------
@@ -1775,7 +1777,8 @@ int mutt_index_menu (void)
 #ifdef USE_NOTMUCH
       case OP_MAIN_ENTIRE_THREAD:
       {
-       if (Context->magic != MUTT_NOTMUCH) {
+       if (!Context || (Context->magic != MUTT_NOTMUCH))
+        {
          mutt_message (_("No virtual folder, aborting."));
          break;
        }
@@ -1810,7 +1813,7 @@ int mutt_index_menu (void)
       case OP_MAIN_MODIFY_LABELS:
       case OP_MAIN_MODIFY_LABELS_THEN_HIDE:
       {
-       if (Context->magic != MUTT_NOTMUCH) {
+       if (!Context || (Context->magic != MUTT_NOTMUCH)) {
          mutt_message (_("No virtual folder, aborting."));
          break;
        }
@@ -1995,7 +1998,7 @@ int mutt_index_menu (void)
 #endif
 #ifdef USE_NOTMUCH
        else if (op == OP_MAIN_CHANGE_VFOLDER) {
-         if (Context->magic == MUTT_NOTMUCH) {
+         if (Context && (Context->magic == MUTT_NOTMUCH)) {
                  strfcpy(buf, Context->path, sizeof (buf));
                  mutt_buffy_vfolder (buf, sizeof (buf));
          }