Commit 776c5242 authored by Thomas Roessler's avatar Thomas Roessler

Don't dump core when closing a NULL context. Fixes the "exit from

no-mailbox mode" bug.
parent 4d94d4f4
......@@ -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;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment