From ff314a52264f1954799cf016cf6e170120e2e89d Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sun, 2 Dec 2018 12:05:41 +0000 Subject: [PATCH] check context before using mailbox --- hook.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hook.c b/hook.c index 743189e93..d2922dd61 100644 --- a/hook.c +++ b/hook.c @@ -502,8 +502,8 @@ static int addr_hook(char *path, size_t pathlen, int type, struct Context *ctx, if (hook->type & type) { - if ((mutt_pattern_exec(hook->pattern, 0, ctx->mailbox, e, &cache) > 0) ^ - hook->regex.not) + struct Mailbox *m = ctx ? ctx->mailbox : NULL; + if ((mutt_pattern_exec(hook->pattern, 0, m, e, &cache) > 0) ^ hook->regex.not) { mutt_make_string_flags(path, pathlen, hook->command, ctx, e, MUTT_FORMAT_PLAIN); return 0; -- 2.40.0