diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/CompareArchives.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/CompareArchives.java index 12d7836ca1..6e1122489d 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/CompareArchives.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/CompareArchives.java @@ -366,7 +366,7 @@ private void compareGeometry(TileCoord coord, String layer, Geometry geom1, Geom compareValues(coord, layer, "feature JTS geometry type", geom1.getGeometryType(), geom2.getGeometryType()); compareValues(coord, layer, "feature num geometries", geom1.getNumGeometries(), geom2.getNumGeometries()); if (geom1 instanceof MultiPolygon) { - for (int i = 0; i < geom1.getNumGeometries(); i++) { + for (int i = 0; i < geom1.getNumGeometries() && i < geom2.getNumGeometries(); i++) { comparePolygon(coord, layer, geometryType, (Polygon) geom1.getGeometryN(i), (Polygon) geom2.getGeometryN(i)); } } else if (geom1 instanceof Polygon p1 && geom2 instanceof Polygon p2) { @@ -378,7 +378,7 @@ private void comparePolygon(TileCoord coord, String layer, String geomType, Poly compareValues(coord, layer, geomType + " exterior ring geometry", p1.getExteriorRing(), p2.getExteriorRing()); if (compareValues(coord, layer, geomType + " num interior rings", p1.getNumInteriorRing(), p2.getNumInteriorRing())) { - for (int i = 0; i < p1.getNumInteriorRing(); i++) { + for (int i = 0; i < p1.getNumInteriorRing() && i < p2.getNumInteriorRing(); i++) { compareValues(coord, layer, geomType + " interior ring geometry", p1.getInteriorRingN(i), p2.getInteriorRingN(i)); }