From: Pietro Cerutti Date: Mon, 30 Jan 2017 10:35:17 +0000 (+0000) Subject: Do not crash when closing a non-opened mailbox X-Git-Tag: neomutt-20170206~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=196cfa65972e055287b3d11ca7323a5f8b3d162b;p=neomutt Do not crash when closing a non-opened mailbox Issue: #342 --- diff --git a/mbox.c b/mbox.c index edec339a9..49fba5f43 100644 --- a/mbox.c +++ b/mbox.c @@ -481,6 +481,11 @@ static int mbox_open_mailbox_append (CONTEXT *ctx, int flags) static int mbox_close_mailbox (CONTEXT *ctx) { + if (!ctx->fp) + { + return 0; + } + if (ctx->append) { mx_unlock_file (ctx->path, fileno (ctx->fp), 1);