diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-08-24 15:25:02 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-08-24 15:25:02 +0100 |
commit | af4fca4b2a5543bc3838897fa603af2e0cdc210c (patch) | |
tree | a903de02abe72a37db75887606b8c651c06bb7d9 /src | |
parent | 73280f3dab76021bd7f04c35448d709cbfb35537 (diff) | |
download | rspamd-af4fca4b2a5543bc3838897fa603af2e0cdc210c.tar.gz rspamd-af4fca4b2a5543bc3838897fa603af2e0cdc210c.zip |
[Minor] Configwizard: Fix usage when the config is wrong
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_config.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index b0e2df672..c6660852a 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -1092,13 +1092,18 @@ lua_config_get_ucl (lua_State * L) lua_rawgeti (L, LUA_REGISTRYINDEX, cached->ref); } else { - ucl_object_push_lua (L, cfg->rcl_obj, true); - lua_pushvalue (L, -1); - cached = rspamd_mempool_alloc (cfg->cfg_pool, sizeof (*cached)); - cached->L = L; - cached->ref = luaL_ref (L, LUA_REGISTRYINDEX); - rspamd_mempool_set_variable (cfg->cfg_pool, "ucl_cached", - cached, lua_config_ucl_dtor); + if (cfg->rcl_obj) { + ucl_object_push_lua(L, cfg->rcl_obj, true); + lua_pushvalue(L, -1); + cached = rspamd_mempool_alloc (cfg->cfg_pool, sizeof(*cached)); + cached->L = L; + cached->ref = luaL_ref(L, LUA_REGISTRYINDEX); + rspamd_mempool_set_variable(cfg->cfg_pool, "ucl_cached", + cached, lua_config_ucl_dtor); + } + else { + lua_pushnil (L); + } } } else { |