diff options
author | Romain Guy <romainguy@google.com> | 2012-09-07 18:35:22 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-09-07 18:37:20 -0700 |
commit | 1558cf1498ecc687532f2dad3de720053dca9309 (patch) | |
tree | 8a1e1dc5baae1736db5e973055d2327536d5174c /graphics | |
parent | 7c0263204384cfa58183b9badcaccdac88efdf72 (diff) | |
download | frameworks_base-1558cf1498ecc687532f2dad3de720053dca9309.zip frameworks_base-1558cf1498ecc687532f2dad3de720053dca9309.tar.gz frameworks_base-1558cf1498ecc687532f2dad3de720053dca9309.tar.bz2 |
Fix crash in ShapeDrawable
Change-Id: Ibc277db46912a73dc3f971f8487baa5eafa8bc84
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/drawable/ShapeDrawable.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/drawable/ShapeDrawable.java b/graphics/java/android/graphics/drawable/ShapeDrawable.java index a3622a2..2ec1293 100644 --- a/graphics/java/android/graphics/drawable/ShapeDrawable.java +++ b/graphics/java/android/graphics/drawable/ShapeDrawable.java @@ -373,8 +373,16 @@ public class ShapeDrawable extends Drawable { @Override public Drawable mutate() { if (!mMutated && super.mutate() == this) { - mShapeState.mPaint = new Paint(mShapeState.mPaint); - mShapeState.mPadding = new Rect(mShapeState.mPadding); + if (mShapeState.mPaint != null) { + mShapeState.mPaint = new Paint(mShapeState.mPaint); + } else { + mShapeState.mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + } + if (mShapeState.mPadding != null) { + mShapeState.mPadding = new Rect(mShapeState.mPadding); + } else { + mShapeState.mPadding = new Rect(); + } try { mShapeState.mShape = mShapeState.mShape.clone(); } catch (CloneNotSupportedException e) { |