Merge pull request #1735 from sumpfralle/olsr-jsoninfo-parser-handle-empty-result

luci-app-olsr: handle empty result for non-status tables
This commit is contained in:
Florian Eckert 2019-09-23 09:04:17 +02:00 committed by GitHub
commit cf239f9e10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -379,9 +379,9 @@ function fetch_jsoninfo(otable)
if jsonreq4 ~= "" then
has_v4 = 1
jsondata4 = json.decode(jsonreq4)
jsondata4 = json.decode(jsonreq4) or {}
if otable == 'status' then
data4 = jsondata4 or {}
data4 = jsondata4
else
data4 = jsondata4[otable] or {}
end
@ -393,9 +393,9 @@ function fetch_jsoninfo(otable)
end
if jsonreq6 ~= "" then
has_v6 = 1
jsondata6 = json.decode(jsonreq6)
jsondata6 = json.decode(jsonreq6) or {}
if otable == 'status' then
data6 = jsondata6 or {}
data6 = jsondata6
else
data6 = jsondata6[otable] or {}
end