From bf974d701dc8a385e9a3e24909899088736429f6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 3 Jul 2018 12:39:43 +0100 Subject: [PATCH] [Fix] Fix specific urls extraction --- lualib/lua_util.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index cf4636aa28..5bf8dc026a 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 -- 2.47.3