Fixed empty boards return

This commit is contained in:
Profitroll 2022-11-13 15:04:00 +01:00
parent 9b6b2d6416
commit e91846edee

View File

@ -63,6 +63,8 @@ class BoardArrival(list):
def __init__(self, data: dict, client, retrieve_stops: bool = True): def __init__(self, data: dict, client, retrieve_stops: bool = True):
super().__init__([]) super().__init__([])
if "Arrival" not in data:
return
for line in data["Arrival"]: for line in data["Arrival"]:
self.append(LineArrival(line, client, retrieve_stops=retrieve_stops)) self.append(LineArrival(line, client, retrieve_stops=retrieve_stops))
@ -76,6 +78,8 @@ class BoardDeparture(list):
def __init__(self, data: dict, client, retrieve_stops: bool = True): def __init__(self, data: dict, client, retrieve_stops: bool = True):
super().__init__([]) super().__init__([])
if "Departure" not in data:
return
for line in data["Departure"]: for line in data["Departure"]:
self.append(LineDeparture(line, client, retrieve_stops=retrieve_stops)) self.append(LineDeparture(line, client, retrieve_stops=retrieve_stops))