From 18862993a87213af170041695c374826945a12df Mon Sep 17 00:00:00 2001 From: Joel Lappalainen Date: Thu, 10 Jun 2021 15:56:16 +0300 Subject: [PATCH] Don't cancel stoptimes if delay is null --- .../routing/edgetype/Timetable.java | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/opentripplanner/routing/edgetype/Timetable.java b/src/main/java/org/opentripplanner/routing/edgetype/Timetable.java index 938ea38e0ba..1fd26772cdd 100644 --- a/src/main/java/org/opentripplanner/routing/edgetype/Timetable.java +++ b/src/main/java/org/opentripplanner/routing/edgetype/Timetable.java @@ -615,14 +615,10 @@ public TripTimes createUpdatedTripTimes(TripUpdate tripUpdate, TimeZone timeZone LOG.error("Arrival time at index {} is erroneous.", i); return null; } - } else { - if (delay == null) { - newTimes.cancelArrivalTime(i); - } else { - newTimes.updateArrivalDelay(i, delay); - if (newTimes.isCanceledArrival(i)) { - newTimes.unCancelArrivalTime(i); - } + } else if (delay != null) { + newTimes.updateArrivalDelay(i, delay); + if (newTimes.isCanceledArrival(i)) { + newTimes.unCancelArrivalTime(i); } } @@ -645,14 +641,10 @@ public TripTimes createUpdatedTripTimes(TripUpdate tripUpdate, TimeZone timeZone LOG.error("Departure time at index {} is erroneous.", i); return null; } - } else { - if (delay == null) { - newTimes.cancelDepartureTime(i); - } else { - newTimes.updateDepartureDelay(i, delay); - if (newTimes.isCanceledDeparture(i)) { - newTimes.unCancelDepartureTime(i); - } + } else if (delay != null) { + newTimes.updateDepartureDelay(i, delay); + if (newTimes.isCanceledDeparture(i)) { + newTimes.unCancelDepartureTime(i); } } }