Skip to content

Commit

Permalink
fix: add None checks
Browse files Browse the repository at this point in the history
closes #1872
  • Loading branch information
alandtse committed Mar 7, 2023
1 parent 289c611 commit 40bb9d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,13 @@ async def async_update_data() -> Optional[AlexaEntityData]:
_LOGGER.debug("Excluding %s for lacking capability", dev_name)
continue

if "bluetoothStates" in bluetooth:
if bluetooth is not None and "bluetoothStates" in bluetooth:
for b_state in bluetooth["bluetoothStates"]:
if serial == b_state["deviceSerialNumber"]:
device["bluetooth_state"] = b_state
break

if "devicePreferences" in preferences:
if preferences is not None and "devicePreferences" in preferences:
for dev in preferences["devicePreferences"]:
if dev["deviceSerialNumber"] == serial:
device["locale"] = dev["locale"]
Expand All @@ -559,7 +559,7 @@ async def async_update_data() -> Optional[AlexaEntityData]:
)
break

if "doNotDisturbDeviceStatusList" in dnd:
if dnd is not None and "doNotDisturbDeviceStatusList" in dnd:
for dev in dnd["doNotDisturbDeviceStatusList"]:
if dev["deviceSerialNumber"] == serial:
device["dnd"] = dev["enabled"]
Expand Down

0 comments on commit 40bb9d2

Please sign in to comment.