From: Vsevolod Stakhov Date: Fri, 1 Mar 2019 14:08:45 +0000 (+0000) Subject: [Minor] Initialise table first X-Git-Tag: 1.9.0~62 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=50c6b049c58f561ea60d7436bd6fc27ce64d827d;p=thirdparty%2Frspamd.git [Minor] Initialise table first --- diff --git a/src/plugins/lua/arc.lua b/src/plugins/lua/arc.lua index 3028617552..59d97fcd44 100644 --- a/src/plugins/lua/arc.lua +++ b/src/plugins/lua/arc.lua @@ -91,6 +91,7 @@ local settings = { } local function parse_arc_header(hdr, target) + -- Split elements by ';' and trim spaces local arr = fun.totable(fun.map( function(val) return fun.totable(fun.map(lua_util.rspamd_str_trim, @@ -102,8 +103,9 @@ local function parse_arc_header(hdr, target) -- Now we have two tables in format: -- [sigs] -> [{sig1_elts}, {sig2_elts}...] for i,elts in ipairs(arr) do + if not target[i] then target[i] = {} end + -- Split by kv pair, like k=v fun.each(function(v) - if not target[i] then target[i] = {} end if v[1] and v[2] then target[i][v[1]] = v[2] end