dont crash when no or empty cables.xml is available
[vuplus_dvbapp] / lib / python / Components / NimManager.py
index ec7d46f..dcc8528 100644 (file)
@@ -597,6 +597,9 @@ class NimManager:
                #
                # Type will be either "DVB-S", "DVB-S2", "DVB-T", "DVB-C" or None.
 
+               # nim_slots is an array which has exactly one entry for each slot, even for empty ones.
+               self.nim_slots = [ ]
+
                nimfile = tryOpen("/proc/bus/nim_sockets")
 
                if nimfile is None:
@@ -621,9 +624,6 @@ class NimManager:
                                entries[current_slot]["name"] = _("N/A")
                nimfile.close()
                
-               # nim_slots is an array which has exactly one entry for each slot, even for empty ones.
-               self.nim_slots = [ ]
-
                for id, entry in entries.items():
                        if not (entry.has_key("name") and entry.has_key("type")):
                                entry["name"] =  _("N/A")
@@ -950,8 +950,8 @@ def InitNimManager(nimmgr):
                        possible_scan_types = [("bands", _("Frequency bands")), ("steps", _("Frequency steps"))]
                        if n:
                                possible_scan_types.append(("provider", _("Provider")))
+                               nim.cable.scan_provider = ConfigSelection(default = "0", choices = list)
                        nim.cable.scan_type = ConfigSelection(default = "bands", choices = possible_scan_types)
-                       nim.cable.scan_provider = ConfigSelection(default = "0", choices = list)
                        nim.cable.scan_band_EU_VHF_I = ConfigYesNo(default = True)
                        nim.cable.scan_band_EU_MID = ConfigYesNo(default = True)
                        nim.cable.scan_band_EU_VHF_III = ConfigYesNo(default = True)