Skip to content

Commit

Permalink
fix crash if request from proxy is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Mar 13, 2020
1 parent 3a70f57 commit 0ffb2c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion web/rx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ recv_loop = function()
url = beerchat.url,
timeout = 30,
}, function(res)
if res.succeeded and res.code == 200 then
if res.succeeded and res.code == 200 and res.data then
local data = minetest.parse_json(res.data)
if not data then
minetest.log("error", "[beerchat] content parsing error: " .. dump(res.data))
minetest.after(5, recv_loop)
return
end

if #data > 0 then
-- array received
for _, item in ipairs(data) do
Expand Down

0 comments on commit 0ffb2c4

Please sign in to comment.