Skip to content

Commit

Permalink
handle non existing links
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed May 14, 2024
1 parent 9637881 commit 03db918
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ private static Feature createDefaultFeature(Link link) {
ft.defaultReturnValue(Double.NaN);
Object2ObjectMap<String, String> categories = new Object2ObjectOpenHashMap<>();

categories.put("highway_type", NetworkUtils.getHighwayType(link));
// Link might not be present in the network
if (link == null)
return new Feature("", "", ft, categories);

String highwayType = NetworkUtils.getHighwayType(link);
categories.put("highway_type", highwayType);
ft.put("speed", NetworkUtils.getAllowedSpeed(link));
ft.put("num_lanes", link.getNumberOfLanes());
ft.put("length", link.getLength());
Expand All @@ -124,7 +129,7 @@ private static Feature createDefaultFeature(Link link) {
}
}

return new Feature("", NetworkUtils.getHighwayType(link), ft, categories);
return new Feature("", highwayType, ft, categories);
}

/**
Expand Down

0 comments on commit 03db918

Please sign in to comment.