luci-app-mwan3: fix assert if route could not select by ubus

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert 2018-01-19 09:49:46 +01:00
parent 4dddecfa93
commit 562a3e5b73
2 changed files with 3 additions and 3 deletions

View file

@ -111,11 +111,11 @@ function diagnosticsData(interface, task)
function get_gateway(inteface)
local dump = require("luci.util").ubus("network.interface.%s" % interface, "status", {})
local gateway
if dump then
if dump and dump.route then
local _, route
for _, route in ipairs(dump.route) do
if dump.route[_].target == "0.0.0.0" then
gateway = dump.route[_].nexthop
gateway = dump.route[_].nexthop
end
end
end

View file

@ -77,7 +77,7 @@ function configCheck()
local dump = require("luci.util").ubus("network.interface.%s" % iface, "status", {})
overview[iface]["default_route"] = false
if dump then
if dump and dump.route then
local _, route
for _, route in ipairs(dump.route) do
if dump.route[_].target == "0.0.0.0" then