ignore json parsing error

This commit is contained in:
Er2 2022-01-23 17:05:18 +03:00
parent 30f7203c5f
commit 4dec8003ed

View file

@ -84,8 +84,8 @@ function tools.req(url, par, f, dbg)
if dbg then print(url, succ, res, par)
-- dump(par))
end
res = json.decode(res or '{}')
if not succ or not res then return {}, false end
local s, res = pcall(json.decode, res or '{}')
if not s or not succ or not res then return {}, false end
return res, true
end