summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-09-07 18:35:22 -0700
committerRomain Guy <romainguy@google.com>2012-09-07 18:37:20 -0700
commit1558cf1498ecc687532f2dad3de720053dca9309 (patch)
tree8a1e1dc5baae1736db5e973055d2327536d5174c /graphics/java
parent7c0263204384cfa58183b9badcaccdac88efdf72 (diff)
downloadframeworks_base-1558cf1498ecc687532f2dad3de720053dca9309.zip
frameworks_base-1558cf1498ecc687532f2dad3de720053dca9309.tar.gz
frameworks_base-1558cf1498ecc687532f2dad3de720053dca9309.tar.bz2
Fix crash in ShapeDrawable
Change-Id: Ibc277db46912a73dc3f971f8487baa5eafa8bc84
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/drawable/ShapeDrawable.java12
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) {