]> granicus.if.org Git - neomutt/commitdiff
check context before using mailbox
authorRichard Russon <rich@flatcap.org>
Sun, 2 Dec 2018 12:05:41 +0000 (12:05 +0000)
committerRichard Russon <rich@flatcap.org>
Sun, 2 Dec 2018 12:05:41 +0000 (12:05 +0000)
hook.c

diff --git a/hook.c b/hook.c
index 743189e93cf6a60f42efc8f3f9963b6eb218d20c..d2922dd61a91b0069a61fdbb8fd56062c0e2d9ff 100644 (file)
--- 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;