Skip to content

Commit f3dda05

Browse files
committed
1 parent 4cf5b37 commit f3dda05

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/MvtReader.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,13 @@ private static Geometry readPoints(GeometryFactory geomFactory, List<Integer> ge
211211

212212
// Guard: header data unsupported by geometry command buffer
213213
// (require header and at least 1 value * 2 params)
214-
if(cmdLength * GeomCmd.MoveTo.getParamCount() + 1 > geomCmds.size()) {
214+
int requiredgeomCmdsLength = cmdLength * GeomCmd.MoveTo.getParamCount() + 1;
215+
if(requiredgeomCmdsLength > geomCmds.size()) {
215216
return null;
216217
}
218+
if (requiredgeomCmdsLength < geomCmds.size()) {
219+
geomCmds = geomCmds.subList(0, requiredgeomCmdsLength); // ignore extra commands... should it return null instead?
220+
}
217221

218222
final CoordinateSequence coordSeq = geomFactory.getCoordinateSequenceFactory().create(cmdLength, 2);
219223
int coordIndex = 0;

0 commit comments

Comments
 (0)