ui: fix device not always castable as bool

This commit is contained in:
Jocelyn Thode 2021-10-28 13:36:31 +02:00 committed by Peter F. Patel-Schneider
parent c1ce3c2c5f
commit 138fe4c756
2 changed files with 2 additions and 2 deletions

View File

@ -451,7 +451,7 @@ def _remove_receiver(receiver):
def _update_menu_item(index, device):
if not device or device.status is None:
if device is None or device.status is None:
_log.warn('updating an inactive device %s, assuming disconnected', device)
return None

View File

@ -886,7 +886,7 @@ def update(device, need_popup=False, refresh=False):
_model.remove(item)
else:
path = device.receiver.path if device.receiver else device.path
path = device.receiver.path if device.receiver is not None else device.path
assert device.number is not None and device.number >= 0, 'invalid device number' + str(device.number)
item = _device_row(path, device.number, device if bool(device) else None)