]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix task:set_recipients when the original recipients are absent
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 28 Nov 2021 12:16:53 +0000 (12:16 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 28 Nov 2021 12:16:53 +0000 (12:16 +0000)
src/lua/lua_task.c

index 48006fa84739bf78891a2182b8ab7ae30fefd1c6..d3e08dee409955e0739992109b75eb3732af65b3 100644 (file)
@@ -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);