Skip to content

Commit

Permalink
[FlashExpander/Swap]
Browse files Browse the repository at this point in the history
* fix crash if disk empty
  • Loading branch information
jbleyel committed Jan 3, 2025
1 parent 814e594 commit a21ee37
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
11 changes: 6 additions & 5 deletions lib/python/Screens/FlashExpander.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,12 @@ def readDevices(self, callback=None):

print("[FlashExpander] DEBUG: uuids -> ", uuids)

for (name, hdd) in harddiskmanager.HDDList():
print("[FlashExpander] DEBUG: HDDList", hdd.device, hdd.dev_path)
uuid, device = uuids.get(hdd.device)
if uuid:
self.deviceData[uuid] = (device, name)
if uuids:
for (name, hdd) in harddiskmanager.HDDList():
print("[FlashExpander] DEBUG: HDDList", hdd.device, hdd.dev_path)
uuid, device = uuids.get(hdd.device)
if uuid:
self.deviceData[uuid] = (device, name)

print("[FlashExpander] DEBUG: self.deviceData", self.deviceData)
self.updateStatus()
Expand Down
17 changes: 9 additions & 8 deletions lib/python/Screens/StartWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,15 @@ def readSwapDevices(self, callback=None):
if disk:
uuids[disk] = (fileReadLine(join("/dev/uuid", fileName)), f"/dev/{fileName}")

for (name, hdd) in harddiskmanager.HDDList():
uuid, device = uuids.get(hdd.device)
if uuid:
self.deviceData[uuid] = (device, name)

print("[StartWizard] DEBUG readSwapDevicesCallback: %s" % str(self.deviceData))
if callback and callable(callback):
callback()
if uuids:
for (name, hdd) in harddiskmanager.HDDList():
uuid, device = uuids.get(hdd.device)
if uuid:
self.deviceData[uuid] = (device, name)

print("[StartWizard] DEBUG readSwapDevicesCallback: %s" % str(self.deviceData))
if callback and callable(callback):
callback()

def getFreeMemory(self):
memInfo = fileReadLines("/proc/meminfo", source=MODULE_NAME)
Expand Down

0 comments on commit a21ee37

Please sign in to comment.