From e38035a80f06e86bd4c14739cd389806d752443f Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sat, 24 Dec 2016 00:26:58 +0000 Subject: [PATCH] fix: some more places that may get NULL pointers --- curs_main.c | 2 +- hdrline.c | 2 ++ mx.c | 2 ++ recvattach.c | 2 ++ send.c | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/curs_main.c b/curs_main.c index 13a1d1698..b6f713e32 100644 --- a/curs_main.c +++ b/curs_main.c @@ -3127,7 +3127,7 @@ int mutt_index_menu (void) CHECK_MSGCOUNT; CHECK_VISIBLE; mutt_view_attachments (CURHDR); - if (CURHDR->attach_del) + if (Context && CURHDR->attach_del) Context->changed = 1; menu->redraw = REDRAW_FULL; break; diff --git a/hdrline.c b/hdrline.c index 1997da2a4..2e3ece7c5 100644 --- a/hdrline.c +++ b/hdrline.c @@ -418,6 +418,8 @@ hdr_format_str (char *dest, hdr = hfi->hdr; ctx = hfi->ctx; + if (!hdr || !hdr->env) + return src; dest[0] = 0; switch (op) { diff --git a/mx.c b/mx.c index af1ae0c39..a6781ba4d 100644 --- a/mx.c +++ b/mx.c @@ -1401,6 +1401,8 @@ int mx_commit_message (MESSAGE *msg, CONTEXT *ctx) /* close a pointer to a message */ int mx_close_message (CONTEXT *ctx, MESSAGE **msg) { + if (!ctx || !msg) + return 0; int r = 0; if (ctx->mx_ops && ctx->mx_ops->close_msg) diff --git a/recvattach.c b/recvattach.c index 769c99eff..b6fd2915e 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1050,6 +1050,8 @@ void mutt_view_attachments (HEADER *hdr) { if (op == OP_NULL) op = mutt_menuLoop (menu); + if (!Context) + return; switch (op) { case OP_ATTACH_VIEW_MAILCAP: diff --git a/send.c b/send.c index 8f9acfc0a..2f0c0a16f 100644 --- a/send.c +++ b/send.c @@ -1223,6 +1223,8 @@ int mutt_resend_message (FILE *fp, CONTEXT *ctx, HEADER *cur) static int is_reply (HEADER *reply, HEADER *orig) { + if (!reply || !reply->env || !orig || !orig->env) + return 0; return mutt_find_list (orig->env->references, reply->env->message_id) || mutt_find_list (orig->env->in_reply_to, reply->env->message_id); } -- 2.40.0