From: Vsevolod Stakhov Date: Tue, 19 Jun 2018 18:12:12 +0000 (+0100) Subject: [Minor] Fix task creation X-Git-Tag: 1.7.7~79 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4424324ba00d4dff20d66e7f544ea1cef3cea43b;p=rspamd.git [Minor] Fix task creation --- diff --git a/src/libserver/task.c b/src/libserver/task.c index 8994214a5..f626a8c7b 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -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; diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 94d4c05dc..ca55609a7 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -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);