From f733592438a244690dc070e93ef01eb5c7b6fb7f Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Sat, 28 Jan 2023 19:58:46 -0800 Subject: [PATCH] Make sure we never pass 'nil' to the json parser (#685) --- files/www/cgi-bin/admin | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index 4df7d95a..11fbf63d 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -317,7 +317,7 @@ if parms.button_refresh_fw then for ver, data in pairs(firmware_versions) do local raw = io.popen(wget .. " -O - " .. config_serverpath .. data .. "/overview.json 2> /dev/null") - local info = luci.jsonc.parse(raw:read("*a")) + local info = luci.jsonc.parse(raw:read("*a") or "") raw:close() firmware_versions[ver] = nil if info then @@ -357,7 +357,7 @@ if nixio.fs.stat("/etc/mesh-release") then end local f = io.open("/tmp/web/firmware.list") if f then - fw_versions = luci.jsonc.parse(f:read("*a")) + fw_versions = luci.jsonc.parse(f:read("*a") or "") f:close() if fw_versions then for v, d in pairs(fw_versions) @@ -440,7 +440,7 @@ if parms.button_dl_fw and parms.dl_fw ~= "default" then local err local f = io.popen(wget .. " -O - " .. fw_versions[parms.dl_fw].overview .. " 2> /dev/null") - local fwinfo = luci.jsonc.parse(f:read("*a")) + local fwinfo = luci.jsonc.parse(f:read("*a") or "") f:close() if fwinfo then