From 1d5b81ff1c0c07d1cb9f11bcf39fa53ef344c4a6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 28 Apr 2016 09:24:36 +0100 Subject: [PATCH] [Test] Properly set lua paths for tests --- src/lua/lua_common.c | 12 +++++++----- test/rspamd_lua_test.c | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 9036955a5..fc65a67df 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -173,11 +173,13 @@ rspamd_lua_set_path (lua_State *L, struct rspamd_config *cfg) return; } - opts = ucl_object_lookup (cfg->rcl_obj, "options"); - if (opts != NULL) { - opts = ucl_object_lookup (opts, "lua_path"); - if (opts != NULL && ucl_object_type (opts) == UCL_STRING) { - additional_path = ucl_object_tostring (opts); + if (cfg) { + opts = ucl_object_lookup (cfg->rcl_obj, "options"); + if (opts != NULL) { + opts = ucl_object_lookup (opts, "lua_path"); + if (opts != NULL && ucl_object_type (opts) == UCL_STRING) { + additional_path = ucl_object_tostring (opts); + } } } diff --git a/test/rspamd_lua_test.c b/test/rspamd_lua_test.c index 12d56e5f0..baad40ed7 100644 --- a/test/rspamd_lua_test.c +++ b/test/rspamd_lua_test.c @@ -106,6 +106,7 @@ rspamd_lua_test_func (void) } lua_setglobal (L, "tests_list"); + rspamd_lua_set_path (L, NULL); lua_pushcfunction (L, traceback); luaL_loadfile (L, rp); -- 2.39.5