Skip to content

Commit

Permalink
account for possible null atribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Kohl committed Nov 21, 2023
1 parent 2cb98ce commit 22fd1b3
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ private void changeEgressTimesByGridcell(Collection<? extends Person> 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);
Expand Down

0 comments on commit 22fd1b3

Please sign in to comment.