Skip to content

Commit

Permalink
Guard against missing data in ReCollect Waste (home-assistant#59177)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachya authored Nov 6, 2021
1 parent c5b5c8c commit 3d0d038
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions homeassistant/components/recollect_waste/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,13 @@ async def async_added_to_hass(self) -> None:
@callback
def update_from_latest_data(self) -> None:
"""Update the state."""
pickup_event = self.coordinator.data[0]
next_pickup_event = self.coordinator.data[1]
try:
pickup_event = self.coordinator.data[0]
next_pickup_event = self.coordinator.data[1]
except IndexError:
self._attr_native_value = None
self._attr_extra_state_attributes = {}
return

self._attr_extra_state_attributes.update(
{
Expand Down

0 comments on commit 3d0d038

Please sign in to comment.