Skip to content

Commit

Permalink
Use empty string for last stop name
Browse files Browse the repository at this point in the history
For the rare cases where the API returns "ghost" stations that are not in `stationsObject`
  • Loading branch information
guytepper committed Dec 16, 2024
1 parent b1a2876 commit bf778c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/services/api/route-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export class RouteApi {
arrivalTimeString: arrivalTime,
originPlatform: originPlatform,
destinationPlatform: destPlatform,
lastStop: stationsObject[lastStationId][stationLocale],
// In rare cases when the API returns "ghost" stations that are not in stationsObject, return an empty string.
lastStop: stationsObject[lastStationId] ? stationsObject[lastStationId][stationLocale] : "",
trainNumber,
stopStations,
routeStations,
Expand Down

0 comments on commit bf778c0

Please sign in to comment.