luci-app-olsr: fix null pointer exception (#6778)
authorAndi Bräu <andibraeu@users.noreply.github.com>
Thu, 21 Dec 2023 21:48:59 +0000 (22:48 +0100)
committerPaul Donald <newtwen@gmail.com>
Thu, 21 Dec 2023 21:49:36 +0000 (21:49 +0000)
for some 'virtual' interfaces, there don't seem to be network status information

Signed-off-by: Andreas Bräu <ab@andi95.de>
(cherry picked from commit 87da3275eaf7a388e77ad137e09b3bf6d3cf97f3)

applications/luci-app-olsr/htdocs/luci-static/resources/view/olsr/status-olsr/neighbors.js

index 694e0a8eb841c1981500b66f0709d1d6626722cf..8feabb32cdd9b2b78b2244aafc5349edc33dda46 100644 (file)
@@ -198,13 +198,13 @@ return view.extend({
                                                }
                                        }
                                        var hosthints = await network.getHostHints();
-                                       var interfac = await network.getStatusByAddress(v.localIP);
+                                       var networkStatus = await network.getStatusByAddress(v.localIP);
                                        var lmac = await hosthints.getMACAddrByIPAddr(v.localIP);
                                        var rmac = await hosthints.getMACAddrByIPAddr(v.remoteIP);
 
                                        for (let i = 0; i < assoclist.length; i++) {
                                                var val = assoclist[i];
-                                               if (val.network === interfac.interface && val.list) {
+                                               if (networkStatus != undefined && val.network === networkStatus.interface && val.list) {
                                                        for (var assocmac in val.list) {
                                                                var assot = val.list[assocmac];
                                                                if (rmac == assot.mac) {
@@ -216,8 +216,8 @@ return view.extend({
                                                }
                                        }
 
-                                       if (interfac) {
-                                               v.interface = interfac;
+                                       if (networkStatus) {
+                                               v.interface = networkStatus;
                                        }
                                        v.snr = snr || null;
                                        v.signal = signal || null;