Skip to content

Commit 92c7dc2

Browse files
committed
chore: fix-bug-in-computePointAtDistanceThreshold
1 parent acc5d09 commit 92c7dc2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

web-bundle/src/main/java/com/graphhopper/resources/BufferResource.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,14 @@ private PointList computePointAtDistanceThreshold(BufferFeature startFeature, Do
484484
EdgeIteratorState finalState = graph.getEdgeIteratorState(endFeature.getEdge(), Integer.MIN_VALUE);
485485
PointList pointList = finalState.fetchWayGeometry(FetchMode.PILLAR_ONLY);
486486

487+
// It is possible that the finalState.fetchWayGeometry(FetchMode.xxxx) would
488+
// only contain TOWER points and not PILLAR points.
489+
// When this happens, filtering by FetchMode.PILLAR_ONLY will return an empty
490+
// PointList.
491+
if (pointList.size() == 0) {
492+
return new PointList();
493+
}
494+
487495
// When the buffer is only as wide as a single edge, truncate one half of the
488496
// segment
489497
if (startFeature.getEdge().equals(endFeature.getEdge())) {

0 commit comments

Comments
 (0)