Crash in fixAnglesInShape

Hi A bug was reported which I can reproduce with the following stack trace: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:635) at java.util.ArrayList.get(ArrayList.java:411) at uk.me.parabola.mkgmap.osmstyle.WrongAngleFixer.fixAnglesInShape(WrongAngleFixer.java:1401) at uk.me.parabola.mkgmap.filters.ShapeMergeFilter.merge(ShapeMergeFilter.java:123) at uk.me.parabola.mkgmap.build.MapBuilder.processShapes(MapBuilder.java:1075) at uk.me.parabola.mkgmap.build.MapBuilder.makeSubdivision(MapBuilder.java:740) This is caused by a shape that consists of many points very close together eg: [2405169/355005, 2405169/355004, 2405169/355004, 2405169/355001, 2405169/355001, 2405169/355001, 2405164/355001, 2405164/355001, 2405164/355001, 2405164/355005, 2405164/355009, 2405164/355009, 2405164/355009, 2405169/355009, 2405169/355009, 2405169/355009, 2405169/355007, 2405169/355007, 2405169/355005] This results in the modifiedPoints list inside fixAnglesInShape() to be empty. The caller expects an empty list, but the last line that closes the polygon fails if the list is empty. The attached patch fixes the crash, but perhaps the situation should be dealt with differently. Any comments? ..Steve

Hi Steve, I think I have a similar problem in the house number generator. I commited a check for that but I guess there are other places where it will make problems if a way has no points. So a general solution would be great! WanMil
Hi
A bug was reported which I can reproduce with the following stack trace:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:635) at java.util.ArrayList.get(ArrayList.java:411) at uk.me.parabola.mkgmap.osmstyle.WrongAngleFixer.fixAnglesInShape(WrongAngleFixer.java:1401)
at uk.me.parabola.mkgmap.filters.ShapeMergeFilter.merge(ShapeMergeFilter.java:123)
at uk.me.parabola.mkgmap.build.MapBuilder.processShapes(MapBuilder.java:1075) at uk.me.parabola.mkgmap.build.MapBuilder.makeSubdivision(MapBuilder.java:740)
This is caused by a shape that consists of many points very close together eg:
[2405169/355005, 2405169/355004, 2405169/355004, 2405169/355001, 2405169/355001, 2405169/355001, 2405164/355001, 2405164/355001, 2405164/355001, 2405164/355005, 2405164/355009, 2405164/355009, 2405164/355009, 2405169/355009, 2405169/355009, 2405169/355009, 2405169/355007, 2405169/355007, 2405169/355005]
This results in the modifiedPoints list inside fixAnglesInShape() to be empty. The caller expects an empty list, but the last line that closes the polygon fails if the list is empty.
The attached patch fixes the crash, but perhaps the situation should be dealt with differently. Any comments?
..Steve
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
participants (2)
-
Steve Ratcliffe
-
WanMil