]> granicus.if.org Git - neomutt/commitdiff
Don't dump core when closing a NULL context. Fixes the "exit from
authorThomas Roessler <roessler@does-not-exist.org>
Sun, 13 Dec 1998 08:10:12 +0000 (08:10 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Sun, 13 Dec 1998 08:10:12 +0000 (08:10 +0000)
no-mailbox mode" bug.

curs_main.c
mx.c

index c0d88404ef5b6a5c582985843b3323e408a94a5b..7c00136792a02ab743c349a62eaee7a09e7df117 100644 (file)
@@ -972,8 +972,11 @@ int mutt_index_menu (void)
            && (query_quadoption (OPT_QUIT, 
                                  _("Exit Mutt without saving?")) == M_YES))
        {
-         mx_fastclose_mailbox (Context);
-         safe_free ((void **) &Context);
+         if (Context)
+         {
+           mx_fastclose_mailbox (Context);
+           safe_free ((void **) &Context);
+         }
          done = 1;
        }
        break;
diff --git a/mx.c b/mx.c
index ddf0d6fc5f14840f17054548c6265f7532085e71..93c917fe6158f6301d010b2f04a0edffc2279330 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -642,6 +642,9 @@ CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
 void mx_fastclose_mailbox (CONTEXT *ctx)
 {
   int i;
+
+  if(!ctx) 
+    return;
   
 #ifdef USE_IMAP
   if (ctx->magic == M_IMAP)
@@ -712,6 +715,8 @@ int mx_close_mailbox (CONTEXT *ctx)
   char mbox[_POSIX_PATH_MAX];
   char buf[SHORT_STRING];
 
+  if (!ctx) return 0;
+
   ctx->closing = 1;
 
   if (ctx->readonly || ctx->dontwrite)