mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 20:25:07 +02:00
Fix NMBS IndexError (#90365)
This commit is contained in:
@@ -162,7 +162,13 @@ class NMBSLiveBoard(SensorEntity):
|
||||
"""Set the state equal to the next departure."""
|
||||
liveboard = self._api_client.get_liveboard(self._station)
|
||||
|
||||
if liveboard is None or not liveboard.get("departures"):
|
||||
if (
|
||||
liveboard is None
|
||||
or liveboard.get("departures") is None
|
||||
or liveboard.get("departures").get("number") is None
|
||||
or liveboard.get("departures").get("number") == "0"
|
||||
or liveboard.get("departures").get("departure") is None
|
||||
):
|
||||
return
|
||||
|
||||
next_departure = liveboard["departures"]["departure"][0]
|
||||
|
Reference in New Issue
Block a user