From: Vsevolod Stakhov Date: Tue, 3 Jul 2018 11:39:43 +0000 (+0100) Subject: [Fix] Fix specific urls extraction X-Git-Tag: 1.7.8~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bf974d701dc8a385e9a3e24909899088736429f6;p=rspamd.git [Fix] Fix specific urls extraction --- diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index cf4636aa2..5bf8dc026 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -559,8 +559,10 @@ exports.extract_specific_urls = function(task, lim, need_emails, filter, prefix) -- We can get urls based on their eslds while lim > 0 do for _,lurls in pairs(eslds) do - table.insert(res, table.remove(lurls)) - lim = lim - 1 + if #lurls > 0 then + table.insert(res, table.remove(lurls)) + lim = lim - 1 + end end end @@ -571,8 +573,10 @@ exports.extract_specific_urls = function(task, lim, need_emails, filter, prefix) if ntlds <= lim then while lim > 0 do for _,lurls in pairs(tlds) do - table.insert(res, table.remove(lurls)) - lim = lim - 1 + if #lurls > 0 then + table.insert(res, table.remove(lurls)) + lim = lim - 1 + end end end