Skip to content

Commit

Permalink
check if source_list is None before treating as array
Browse files Browse the repository at this point in the history
len(None) will throw an error
  • Loading branch information
kheyse authored Aug 23, 2022
1 parent 554ef06 commit 9830f89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/controllerx/cx_core/type/media_player_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def change_source_list(self, direction: str) -> None:
entity_states = await self.get_entity_state(attribute="all")
entity_attributes = entity_states["attributes"]
source_list: List[str] = entity_attributes.get("source_list")
if len(source_list) == 0 or source_list is None:
if source_list is None or len(source_list) == 0:
self.log(
f"⚠️ There is no `source_list` parameter in `{self.entity}`",
level="WARNING",
Expand Down

0 comments on commit 9830f89

Please sign in to comment.