diff --git a/contribs/parking/src/main/java/org/matsim/contrib/parking/parkingproxy/CarEgressWalkChanger.java b/contribs/parking/src/main/java/org/matsim/contrib/parking/parkingproxy/CarEgressWalkChanger.java index ee2a32a759e..b78bd899b78 100644 --- a/contribs/parking/src/main/java/org/matsim/contrib/parking/parkingproxy/CarEgressWalkChanger.java +++ b/contribs/parking/src/main/java/org/matsim/contrib/parking/parkingproxy/CarEgressWalkChanger.java @@ -122,9 +122,11 @@ private void changeEgressTimesByGridcell(Collection population for (Person p : population) { for (LegActPair walkActPair : this.egressFinder.findEgressWalks(p.getSelectedPlan())) { if (reverse) { - double penalty = (double) walkActPair.leg.getAttributes().getAttribute(PENALTY_ATTRIBUTE); - setTimes(walkActPair, -penalty); - walkActPair.leg.getAttributes().removeAttribute(PENALTY_ATTRIBUTE); + Object readPenalty = walkActPair.leg.getAttributes().getAttribute(PENALTY_ATTRIBUTE); + if (readPenalty != null) { + setTimes(walkActPair, - (double) readPenalty); + walkActPair.leg.getAttributes().removeAttribute(PENALTY_ATTRIBUTE); + } } else { double penalty = Math.round(this.observer.getPenaltyCalculator().getPenalty(walkActPair.leg.getDepartureTime().seconds(), walkActPair.act.getCoord())); setTimes(walkActPair, penalty);