Skip to content

Commit

Permalink
Fix unhandled exception with missing IQVIA data (#125114)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachya authored and bramkragten committed Sep 3, 2024
1 parent a0bbcb0 commit 393a0ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/iqvia/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ def update_from_latest_data(self) -> None:
key = self.entity_description.key.split("_")[-1].title()

try:
[period] = [p for p in data["periods"] if p["Type"] == key] # type: ignore[index]
except TypeError:
period = next(p for p in data["periods"] if p["Type"] == key) # type: ignore[index]
except StopIteration:
return

data = cast(dict[str, Any], data)
Expand Down

0 comments on commit 393a0ac

Please sign in to comment.