From: Richard Russon Date: Mon, 7 Jan 2019 23:08:49 +0000 (+0000) Subject: fix crash in ci_send_message() X-Git-Tag: 2019-10-25~393 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c3156fc6f46c1366cef7c510cb43c388788899e;p=neomutt fix crash in ci_send_message() Fixes #1525 --- diff --git a/send.c b/send.c index 1da563de4..533d0076b 100644 --- a/send.c +++ b/send.c @@ -1958,10 +1958,12 @@ int ci_send_message(int flags, struct Email *msg, const char *tempfile, mutt_fix_reply_recipients(msg->env); #ifdef USE_NNTP - if ((flags & SEND_NEWS) && ctx && ctx->mailbox->magic == MUTT_NNTP && + if ((flags & SEND_NEWS) && ctx && (ctx->mailbox->magic == MUTT_NNTP) && !msg->env->newsgroups) + { msg->env->newsgroups = mutt_str_strdup(((struct NntpMboxData *) ctx->mailbox->mdata)->group); + } #endif if (!(flags & (SEND_MAILX | SEND_BATCH)) && !(Autoedit && EditHeaders) && @@ -1985,7 +1987,7 @@ int ci_send_message(int flags, struct Email *msg, const char *tempfile, if ((flags & SEND_REPLY) && cur) { /* change setting based upon message we are replying to */ - mutt_message_hook(ctx->mailbox, cur, MUTT_REPLY_HOOK); + mutt_message_hook(ctx ? ctx->mailbox : NULL, cur, MUTT_REPLY_HOOK); /* set the replied flag for the message we are generating so that the * user can use ~Q in a send-hook to know when reply-hook's are also @@ -2469,7 +2471,7 @@ int ci_send_message(int flags, struct Email *msg, const char *tempfile, _("Mail sent")); #ifdef USE_NOTMUCH if (NmRecord) - nm_record_message(ctx->mailbox, finalpath, cur); + nm_record_message(ctx ? ctx->mailbox : NULL, finalpath, cur); #endif mutt_sleep(0); }