luci-app-mwan3: fix assert if route could not select by ubus
authorFlorian Eckert <fe@dev.tdt.de>
Fri, 19 Jan 2018 08:49:46 +0000 (09:49 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Tue, 23 Jan 2018 12:30:24 +0000 (13:30 +0100)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-mwan3/luasrc/controller/mwan3.lua
applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua

index cf5708051f4282d0b1f73a8049a3ec18cbc3db65..5249d4e22d66394c3164de5533a4b2abd4db7e04 100644 (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
index 166f0779102b92bac425bb65f2636d488e06708d..f680840fcd5e0ada213beb67eaa6763f03ffa80a 100644 (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