diff options
author | Romain Guy <romainguy@google.com> | 2012-09-07 18:38:02 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-07 18:38:03 -0700 |
commit | be6024d57140a81883e6c5a27cae56a7d31d10dc (patch) | |
tree | ac12e09174a63a549096e86410370aa77d035297 /graphics | |
parent | 1ac44eb94d41019961209716052cc81f526440f8 (diff) | |
parent | 1558cf1498ecc687532f2dad3de720053dca9309 (diff) | |
download | frameworks_base-be6024d57140a81883e6c5a27cae56a7d31d10dc.zip frameworks_base-be6024d57140a81883e6c5a27cae56a7d31d10dc.tar.gz frameworks_base-be6024d57140a81883e6c5a27cae56a7d31d10dc.tar.bz2 |
Merge "Fix crash in ShapeDrawable" into jb-mr1-dev
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) { |