summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/nvm13
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/nvm b/bin/nvm
index 6bb82b3..8014e88 100755
--- a/bin/nvm
+++ b/bin/nvm
@@ -289,12 +289,13 @@ async def show_departure_board(request):
if len(departures) and ", " in station_name:
name, place = station_name.split(", ")
efa_endpoint = apis.get_efa(departures[0].location)
- efa = EFA(efa_endpoint["endpoint"])
- efa_departures = await efa.get_departures(place, name, now)
- for departure in efa_departures:
- if departure.iso8601 not in efa_by_iso8601:
- efa_by_iso8601[departure.iso8601] = list()
- efa_by_iso8601[departure.iso8601].append(departure)
+ if efa_endpoint:
+ efa = EFA(efa_endpoint["endpoint"])
+ efa_departures = await efa.get_departures(place, name, now)
+ for departure in efa_departures:
+ if departure.iso8601 not in efa_by_iso8601:
+ efa_by_iso8601[departure.iso8601] = list()
+ efa_by_iso8601[departure.iso8601].append(departure)
for departure in departures:
departure.add_efa(efa_by_iso8601.get(departure.iso8601, list()))