Fix upload crash

master
Lars Mueller 2022-01-16 16:50:39 +01:00
parent 45e8efd2f5
commit 5bab7a876e
1 changed files with 3 additions and 1 deletions

View File

@ -46,9 +46,11 @@ function epidermis.upload(params)
end
local status, data_or_err = pcall(modlib.json.read_string, modlib.json, res.data)
if not status then
params.on_complete("JSON error: " .. data_or_err)
local err = data_or_err
params.on_complete("JSON error: " .. err)
return
end
local data = data_or_err
if not data.success then
local message = data.status_msg
if #message > 100 then -- trim to 100 characters