do not crash when attributes are not present; replace by defaults instead
[enigma2.git] / lib / python / Screens / NetworkSetup.py
index 8a3dadb..cf03f11 100644 (file)
@@ -109,11 +109,11 @@ class AdapterSetup(Screen, ConfigListScreen):
                self.iface = iface
 
                print iNetwork.getAdapterAttribute(self.iface, "dhcp")
-               self.dhcpConfigEntry = NoSave(ConfigYesNo(default=iNetwork.getAdapterAttribute(self.iface, "dhcp")))
+               self.dhcpConfigEntry = NoSave(ConfigYesNo(default=iNetwork.getAdapterAttribute(self.iface, "dhcp") or False))
                self.hasGatewayConfigEntry = NoSave(ConfigYesNo(default=True))
-               self.ipConfigEntry = NoSave(ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "ip")))
-               self.netmaskConfigEntry = NoSave(ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "netmask")))
-               self.gatewayConfigEntry = NoSave(ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "gateway")))
+               self.ipConfigEntry = NoSave(ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "ip")) or [0,0,0,0])
+               self.netmaskConfigEntry = NoSave(ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "netmask") or [255,0,0,0]))
+               self.gatewayConfigEntry = NoSave(ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "gateway") or [0,0,0,0]))
        
                self["iface"] = Label(iNetwork.getFriendlyAdapterName(self.iface))