ignore json parsing error
This commit is contained in:
parent
30f7203c5f
commit
4dec8003ed
1 changed files with 3 additions and 3 deletions
|
@ -72,7 +72,7 @@ function tools.req(url, par, f, dbg)
|
|||
if fr then
|
||||
par[ft] = {
|
||||
filename = fn,
|
||||
data = fr:read '*a'
|
||||
data = fr:read '*a'
|
||||
}
|
||||
fr:close()
|
||||
else par[ft] = fn end
|
||||
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue