]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix task creation
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Jun 2018 18:12:12 +0000 (19:12 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Jun 2018 18:12:12 +0000 (19:12 +0100)
src/libserver/task.c
src/lua/lua_task.c

index 8994214a5ad7f8a4277af0cd29db47c74fa980a7..f626a8c7b445202bab5f650758262d9339550dd1 100644 (file)
@@ -79,7 +79,10 @@ rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg,
                        new_task->flags |= RSPAMD_TASK_FLAG_PASS_ALL;
                }
 
-               new_task->re_rt = rspamd_re_cache_runtime_new (cfg->re_cache);
+
+               if (cfg->re_cache) {
+                       new_task->re_rt = rspamd_re_cache_runtime_new (cfg->re_cache);
+               }
 
                if (new_task->lang_det == NULL && cfg->lang_det != NULL) {
                        new_task->lang_det = cfg->lang_det;
index 94d4c05dcfe29919113bb9f1907f68d5d74a89a5..ca55609a7de782afc2de0e918c84d880086e6d1e 100644 (file)
@@ -1226,7 +1226,12 @@ lua_task_load_from_file (lua_State * L)
        if (fname) {
 
                if (lua_type (L, 2) == LUA_TUSERDATA) {
-                       cfg = rspamd_lua_check_udata_maybe (L, 2, "rspamd{config}");
+                       gpointer p;
+                       p = rspamd_lua_check_udata_maybe (L, 2, "rspamd{config}");
+
+                       if (p) {
+                               cfg = *(struct rspamd_config **)p;
+                       }
                }
 
                map = rspamd_file_xmap (fname, PROT_READ, &sz, TRUE);