Skip to content

Commit

Permalink
fix(Route): handle null reference in train delay calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
gilad-teller committed Feb 27, 2024
1 parent 85bf6e2 commit 6a7d211
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion IsraelRail/IsraelRail/Models/ViewModels/Route.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public async Task<IEnumerable<Route>> BuildRoutes(TimetableResult timetable)
};
if (apiTrain.TrainPosition != null)
{
train.Delay = TimeSpan.FromMinutes(travel.Trains[0].TrainPosition.CalcDiffMinutes);
train.Delay = TimeSpan.FromMinutes(travel?.Trains[0]?.TrainPosition?.CalcDiffMinutes ?? 0);
}
foreach (RouteStation routeStation in apiTrain.RouteStations)
{
Expand Down

0 comments on commit 6a7d211

Please sign in to comment.