From: Mikhail Galanin Date: Mon, 8 Oct 2018 16:53:33 +0000 (+0100) Subject: [Minor] Fix checking table size when inserting/deleting X-Git-Tag: 1.8.1~64^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41deb94d44828c326c69ca0fb5468058818fedfd;p=thirdparty%2Frspamd.git [Minor] Fix checking table size when inserting/deleting --- diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index e8fbe2deef..3c1a431cf2 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -656,9 +656,14 @@ exports.extract_specific_urls = function(params_or_task, lim, need_emails, filte for i=1,ntlds / 2 do local tld1 = tlds[tlds_keys[i]] local tld2 = tlds[tlds_keys[ntlds - i]] - table.insert(res, table.remove(tld1)) - table.insert(res, table.remove(tld2)) - limit = limit - 2 + if #tld1 > 0 then + table.insert(res, table.remove(tld1)) + limit = limit - 1 + end + if #tld2 > 0 then + table.insert(res, table.remove(tld2)) + limit = limit - 1 + end if limit <= 0 then break