From: Michael Elkins Date: Sat, 7 Apr 2007 23:22:49 +0000 (-0700) Subject: Allow reply-hook to use ~h when replying from the index. Fixes regression introduce... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=596df1c3bf82f528a06a2f72d4d00f0b554e5bcf;p=neomutt Allow reply-hook to use ~h when replying from the index. Fixes regression introduced by fix for bug #2190. mutt_pattern_exec() now checks for ctx!=NULL so that Mutt will no longer segfault when replying to a message from the attachment menu. --- diff --git a/hook.c b/hook.c index f0f98f7e8..bee3c4878 100644 --- a/hook.c +++ b/hook.c @@ -157,7 +157,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) if (data & (M_SENDHOOK | M_SEND2HOOK | M_SAVEHOOK | M_FCCHOOK | M_MESSAGEHOOK | M_REPLYHOOK)) { if ((pat = mutt_pattern_comp (pattern.data, - (data & (M_SENDHOOK | M_SEND2HOOK | M_FCCHOOK | M_REPLYHOOK)) ? 0 : M_FULL_MSG, + (data & (M_SENDHOOK | M_SEND2HOOK | M_FCCHOOK)) ? 0 : M_FULL_MSG, err)) == NULL) goto error; } diff --git a/pattern.c b/pattern.c index fcc03569e..facf2a965 100644 --- a/pattern.c +++ b/pattern.c @@ -1132,6 +1132,12 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags, CONTEXT *ctx, case M_BODY: case M_HEADER: case M_WHOLE_MSG: + /* + * ctx can be NULL in certain cases, such as when replying to a message from the attachment menu and + * the user has a reply-hook using "~h" (bug #2190). + */ + if (!ctx) + return 0; #ifdef USE_IMAP /* IMAP search sets h->matched at search compile time */ if (ctx->magic == M_IMAP && pat->stringmatch)