a-student/SvgToVectorDrawableConverter

Scientific notation in vector XML Path throws IndexOutOfBoundsException

primax79 opened this issue · 2 comments

error.zip

In some Android version (es 5.0.2) scientific notation inside the xml crashes the app (maybe the locale of the app can be involved, the app were tested in italian)

My testers signaled a lot of crashes, I've found a lot of this exceptions inside Crashlytics

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=17; index=17 at android.util.PathParser$PathDataNode.addCommand(PathParser.java:370) at android.util.PathParser$PathDataNode.nodesToPath(PathParser.java:260) at android.graphics.drawable.VectorDrawable$VPath.toPath(VectorDrawable.java:1265) at android.graphics.drawable.VectorDrawable$VPathRenderer.drawPath(VectorDrawable.java:950) at android.graphics.drawable.VectorDrawable$VPathRenderer.drawGroupTree(VectorDrawable.java:931) at android.graphics.drawable.VectorDrawable$VPathRenderer.draw(VectorDrawable.java:938) at android.graphics.drawable.VectorDrawable$VectorDrawableState.updateCachedBitmap(VectorDrawable.java:705) at android.graphics.drawable.VectorDrawable.draw(VectorDrawable.java:280) at android.widget.ImageView.onDraw(ImageView.java:1166)

the generated XML contains some values expressed in scientific notation (eg. -5e-4 ). replacing them with stanard notation the app works perfectly

reference:
https://code.google.com/p/android/issues/detail?id=78162
http://stackoverflow.com/questions/33737192/android-vector-drawable-crash

kuffs commented

I also see this error.

Fixed