luci-olsr: fix ipv6 nil in device var
authorPatrick Grimm <patrick@lunatiki.de>
Sun, 11 Aug 2013 21:07:25 +0000 (21:07 +0000)
committerPatrick Grimm <patrick@lunatiki.de>
Sun, 11 Aug 2013 21:07:25 +0000 (21:07 +0000)
applications/luci-olsr/luasrc/controller/olsr.lua

index cf3743f..9661318 100644 (file)
@@ -199,11 +199,13 @@ function action_neigh(json)
                                local net = ntm:get_network(name)
                                local device = net and net:get_interface()
                                local locip = ipc.IPv6(v.localIP)
                                local net = ntm:get_network(name)
                                local device = net and net:get_interface()
                                local locip = ipc.IPv6(v.localIP)
-                               for _, a in ipairs(device:ip6addrs()) do
-                                       if not a:is6linklocal() then
-                                               if a:host() == locip:host() then
-                                                       interface = name
-                                                       neihgt = neightbl.get(device.ifname) or {}
+                               if device and device:ip6addrs() and locip then
+                                       for _, a in ipairs(device:ip6addrs()) do
+                                               if not a:is6linklocal() then
+                                                       if a:host() == locip:host() then
+                                                               interface = name
+                                                               neihgt = neightbl.get(device.ifname) or {}
+                                                       end
                                                end
                                        end
                                end
                                                end
                                        end
                                end