From: Vsevolod Stakhov Date: Thu, 25 Feb 2021 12:42:38 +0000 (+0000) Subject: [Fix] Selectors: Properly fix implicit tostring for nils X-Git-Tag: 3.0~645 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bb5930abfa451f72e0652acb6282c500c39f1ac;p=thirdparty%2Frspamd.git [Fix] Selectors: Properly fix implicit tostring for nils --- diff --git a/lualib/lua_selectors/init.lua b/lualib/lua_selectors/init.lua index cc44d0b017..e971e14c3f 100644 --- a/lualib/lua_selectors/init.lua +++ b/lualib/lua_selectors/init.lua @@ -64,9 +64,11 @@ local function implicit_tostring(t, ud_or_table) else return tostring(ud_or_table),'string' end - else + elseif t ~= 'nil' then return tostring(ud_or_table),'string' end + + return nil end local function process_selector(task, sel) @@ -350,6 +352,8 @@ exports.parse_selector = function(cfg, str) end local ret_type = type(ret) + + if ret_type == 'nil' then return nil end -- Now apply types heuristic if ret_type == 'string' then return ret,'string'