Fix unhandled exception with missing IQVIA data (#125114)
This commit is contained in:
parent
d12c6f89d2
commit
c71cf272c8
1 changed files with 2 additions and 2 deletions
|
@ -244,8 +244,8 @@ class IndexSensor(IQVIAEntity, SensorEntity):
|
|||
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue