OSDN Git Service

Don't crash when drawing zero pixels.
authorDan Sandler <dsandler@android.com>
Fri, 25 Jul 2014 14:55:27 +0000 (10:55 -0400)
committerDan Sandler <dsandler@android.com>
Fri, 25 Jul 2014 16:46:47 +0000 (16:46 +0000)
Bug: 16561522
Change-Id: Ia3a2d2930abc393dbe587053f598246c49c0c9c4

graphics/java/android/graphics/drawable/VectorDrawable.java

index 8ed6776..f32fa1f 100644 (file)
@@ -188,6 +188,12 @@ public class VectorDrawable extends Drawable {
     public void draw(Canvas canvas) {
         final int saveCount = canvas.save();
         final Rect bounds = getBounds();
+
+        if (bounds.width() == 0 || bounds.height() == 0) {
+            // too small to draw
+            return;
+        }
+
         final boolean needMirroring = needMirroring();
 
         canvas.translate(bounds.left, bounds.top);