Browse Source

fix key error bug

Sunz3r 7 years ago
parent
commit
d725682f42
1 changed files with 9 additions and 9 deletions
  1. 9 9
      ext-respondd.py

+ 9 - 9
ext-respondd.py

@@ -268,15 +268,15 @@ def getNeighbours():
                                 "inactive": stationDump[mac_origin]["inactive time"],
                         }
 
-
-                    if not mesh_ifs[dev] in j["batadv"]:
-                        j["batadv"][mesh_ifs[dev]] = {}
-                        j["batadv"][mesh_ifs[dev]]["neighbours"] = {}
-
-                    j["batadv"][mesh_ifs[dev]]["neighbours"][mac_origin] = {
-                        "tq": int(tq),
-                        "lastseen": float(lastseen),
-                    }
+                    if dev in mesh_ifs:
+                        if not mesh_ifs[dev] in j["batadv"]:
+                            j["batadv"][mesh_ifs[dev]] = {}
+                            j["batadv"][mesh_ifs[dev]]["neighbours"] = {}
+
+                        j["batadv"][mesh_ifs[dev]]["neighbours"][mac_origin] = {
+                            "tq": int(tq),
+                            "lastseen": float(lastseen),
+                        }
     return j
 
 def getCPUInfo():