Skip to content

Commit

Permalink
fix null exception
Browse files Browse the repository at this point in the history
  • Loading branch information
miklcct committed Jan 16, 2025
1 parent 4c3983b commit c45bce7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.LineString;
Expand Down Expand Up @@ -425,8 +426,9 @@ private void buildBasicGraph() {
normalizer.applyWayProperties(street, backStreet, wayData, way);

platform.ifPresent(plat -> {
osmInfoGraphBuildRepository.addPlatform(street, plat);
osmInfoGraphBuildRepository.addPlatform(backStreet, plat);
for (var s : streets.asIterable()) {
osmInfoGraphBuildRepository.addPlatform(s, plat);
}
});

applyEdgesToTurnRestrictions(way, startNode, endNode, street, backStreet);
Expand Down Expand Up @@ -488,8 +490,8 @@ private void applyEdgesToTurnRestrictions(
OsmWay way,
long startNode,
long endNode,
StreetEdge street,
StreetEdge backStreet
@Nullable StreetEdge street,
@Nullable StreetEdge backStreet
) {
/* Check if there are turn restrictions starting on this segment */
Collection<TurnRestrictionTag> restrictionTags = osmdb.getFromWayTurnRestrictions(way.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nullable;
import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore;
import org.opentripplanner.graph_builder.issues.Graphwide;
import org.opentripplanner.osm.model.OsmWithTags;
Expand Down Expand Up @@ -74,8 +75,8 @@ void applySafetyFactors() {
}

void applyWayProperties(
StreetEdge street,
StreetEdge backStreet,
@Nullable StreetEdge street,
@Nullable StreetEdge backStreet,
WayProperties wayData,
OsmWithTags way
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.opentripplanner.graph_builder.module.osm;

import java.util.ArrayList;
import javax.annotation.Nullable;
import org.opentripplanner.street.model.edge.StreetEdge;

public record StreetEdgePair(StreetEdge main, StreetEdge back) {
public record StreetEdgePair(@Nullable StreetEdge main, @Nullable StreetEdge back) {
/**
* Return the non-null elements of this pair as an Iterable.
*/
Expand Down

0 comments on commit c45bce7

Please sign in to comment.