]> granicus.if.org Git - neomutt/commitdiff
Do not crash when closing a non-opened mailbox
authorPietro Cerutti <gahr@gahr.ch>
Mon, 30 Jan 2017 10:35:17 +0000 (10:35 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 30 Jan 2017 23:54:18 +0000 (23:54 +0000)
Issue: #342

mbox.c

diff --git a/mbox.c b/mbox.c
index edec339a949ac16bcdc8cfd48d40df7c4d1c0908..49fba5f43c2aabb123a1d905370ae258fad32596 100644 (file)
--- 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);