Skip to content

Commit

Permalink
add way to handel link is null
Browse files Browse the repository at this point in the history
  • Loading branch information
GregorRyb committed Jan 4, 2024
1 parent 4c2a480 commit 67d860f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/org/matsim/run/LeipzigUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,20 @@ private enum LinkParkingType{linkOutsideResidentialArea, linkInResidentialArea}
* Check if link is inside residential area or not (parking on link is restricted or not).
*/
public static boolean isLinkParkingTypeInsideResidentialArea(Link link ) {
String result = (String) link.getAttributes().getAttribute( "linkParkingType" );

/**
* If a link is null he is not in the modal network anymore. The default logic is as in the car free area all agents can´t park at the closest link as well
*/
String result;
if (link != null) {
result = (String) link.getAttributes().getAttribute("linkParkingType");
} else {
result = null;
}

boolean insideResidentialArea = true;

if ( result == null ) {
if (result == null) {
insideResidentialArea = false;
}
return insideResidentialArea;
Expand Down

0 comments on commit 67d860f

Please sign in to comment.