Protect against OLSRD returning nil results (#236)

This commit is contained in:
Tim Wilkinson 2022-02-27 19:19:04 -08:00 committed by GitHub
parent 301112fb37
commit 4c3cd854a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -43,22 +43,22 @@ local model = {}
function model.getOLSRLinks()
local links=fetch_json("http://127.0.0.1:9090/links")
return links['links']
return links and links['links'] or {}
end
function model.getOLSRRoutes()
local routes=fetch_json("http://127.0.0.1:9090/routes")
return routes['routes']
return routes and routes['routes'] or {}
end
function model.getOLSRHNA()
local hna=fetch_json("http://127.0.0.1:9090/hna")
return hna['hna']
return hna and hna['hna'] or {}
end
function model.getOLSRMid()
local mid=fetch_json("http://127.0.0.1:9090/mid")
return mid['mid']
return mid and mid['mid'] or {}
end
function model.getOLSRInterfaceType(iface)