Browse Source

[Minor] Add fail-safety for settings post load

tags/2.7
Vsevolod Stakhov 3 years ago
parent
commit
3003f8f75f
2 changed files with 5 additions and 1 deletions
  1. 4
    0
      lualib/lua_settings.lua
  2. 1
    1
      src/lua/lua_task.c

+ 4
- 0
lualib/lua_settings.lua View File

@@ -32,6 +32,10 @@ local lua_util = require "lua_util"
local rspamd_logger = require "rspamd_logger"

local function register_settings_cb(from_postload)
if not from_postload then
assert(false, 'invalid invocation')
end

if not post_init_performed then
all_symbols = rspamd_config:get_symbols()


+ 1
- 1
src/lua/lua_task.c View File

@@ -5774,7 +5774,7 @@ lua_task_set_settings_id (lua_State *L)
rspamd_config_find_settings_id_ref (task->cfg, id);

if (selt == NULL) {
return luaL_error (L, "settings id %u is unknown", id);
return luaL_error (L, "settings id %f is unknown", (lua_Number)id);
}
if (task->settings_elt) {
/* Overwrite existing settings from Lua */

Loading…
Cancel
Save