fixed java.lang.IndexOutOfBoundsException when first way was without any
nodes.
This commit is contained in:
parent
13fda484e5
commit
41be54750f
2 changed files with 22 additions and 13 deletions
|
@ -168,6 +168,13 @@ public class MultipolygonTest {
|
|||
assertFalse(testee.hasOpenedPolygons());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test_firstEmptyWayThanOpenedWay()
|
||||
{
|
||||
testee.addOuterWay(new Way(111));
|
||||
testee.addOuterWay(poly1_1_of_2);
|
||||
assertEquals(1, testee.countOuterPolygons());
|
||||
assertTrue(testee.hasOpenedPolygons());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public class Multipolygon {
|
|||
protected IdentityHashMap<Way,List<Way>> outerInnerMapping;
|
||||
|
||||
private void addNewPolygonPart(List<Way> polygons, List<Way> closedPolygons, Way newPoly) {
|
||||
if (!newPoly.getNodes().isEmpty()) {
|
||||
if (isClosed(newPoly)) {
|
||||
closedPolygons.add(newPoly); //if closed, put directly to closed polygons
|
||||
} else if (polygons.isEmpty()) {
|
||||
|
@ -44,6 +45,7 @@ public class Multipolygon {
|
|||
}
|
||||
//reset the mapping
|
||||
outerInnerMapping = null;
|
||||
} //else do nothing
|
||||
}
|
||||
|
||||
private boolean isClosed(Way newPoly) {
|
||||
|
|
Loading…
Reference in a new issue