From 196cfa65972e055287b3d11ca7323a5f8b3d162b Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Mon, 30 Jan 2017 10:35:17 +0000 Subject: [PATCH] Do not crash when closing a non-opened mailbox Issue: #342 --- mbox.c | 5 +++++ 1 file changed, 5 insertions(+) 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); -- 2.40.0