Skip to content

Commit

Permalink
Fix crashing bug for devices that return a properties dict of {b'': N…
Browse files Browse the repository at this point in the history
…one} (for example, the HP OfficeJet Pro 9010), since decode cannot be called against None. (#1358)
  • Loading branch information
pmkane authored Jan 23, 2024
1 parent ceb8cb3 commit c7a0800
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/flash-shelly.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def add_service(self, zc, service_type, device):
fw_type = None
wifi_ip = socket.inet_ntoa(info.addresses[0])
properties = info.properties
properties = {y.decode('UTF-8'): properties.get(y).decode('UTF-8') for y in properties.keys()}
properties = {y.decode('UTF-8'): properties.get(y).decode('UTF-8') for y in properties.keys() if properties.get(y) is not None}
logger.debug(f"[Device Scan] found device: {host}, IP address: {wifi_ip}")
logger.trace(f"[Device Scan] info: {info}")
logger.trace(f"[Device Scan] properties: {properties}")
Expand Down

0 comments on commit c7a0800

Please sign in to comment.