From 449b77cc82eacd9928f1fee7f4559eeb048c284b Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 28 Nov 2021 12:16:53 +0000 Subject: [PATCH] [Minor] Fix task:set_recipients when the original recipients are absent --- src/lua/lua_task.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 48006fa84..d3e08dee4 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -3703,7 +3703,13 @@ lua_task_set_recipients (lua_State *L) switch (what) { case RSPAMD_ADDRESS_SMTP: /* Here we check merely envelope rcpt */ - ptrs = task->rcpt_envelope; + if (task->rcpt_envelope) { + ptrs = task->rcpt_envelope; + } + else { + ptrs = g_ptr_array_new (); + task->rcpt_envelope = ptrs; + } break; case RSPAMD_ADDRESS_MIME: /* Here we check merely mime rcpt */ @@ -3713,7 +3719,13 @@ lua_task_set_recipients (lua_State *L) case RSPAMD_ADDRESS_ANY: default: if (task->rcpt_envelope) { - ptrs = task->rcpt_envelope; + if (task->rcpt_envelope) { + ptrs = task->rcpt_envelope; + } + else { + ptrs = g_ptr_array_new (); + task->rcpt_envelope = ptrs; + } } else { ptrs = MESSAGE_FIELD_CHECK (task, rcpt_mime); -- 2.39.5