summaryrefslogtreecommitdiffstats
path: root/graphics/java/android
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-08-06 14:27:30 -0700
committerRomain Guy <romainguy@google.com>2010-08-06 14:27:30 -0700
commit9e044aed219adf52e27629d36f8ff7d670700a52 (patch)
tree9f9af017b665e982db84f5d9fca479e3d9d22570 /graphics/java/android
parent145b0c8be78c551833246d9473dacf1de3a62f9d (diff)
downloadframeworks_base-9e044aed219adf52e27629d36f8ff7d670700a52.zip
frameworks_base-9e044aed219adf52e27629d36f8ff7d670700a52.tar.gz
frameworks_base-9e044aed219adf52e27629d36f8ff7d670700a52.tar.bz2
Fix NPE in RoundRectShape.
Change-Id: I3cef1b2723e5ebf3583f91b1bfe8121c0f6d253d
Diffstat (limited to 'graphics/java/android')
-rw-r--r--graphics/java/android/graphics/drawable/shapes/RoundRectShape.java15
1 files changed, 6 insertions, 9 deletions
diff --git a/graphics/java/android/graphics/drawable/shapes/RoundRectShape.java b/graphics/java/android/graphics/drawable/shapes/RoundRectShape.java
index f4cf15c..b469d2a 100644
--- a/graphics/java/android/graphics/drawable/shapes/RoundRectShape.java
+++ b/graphics/java/android/graphics/drawable/shapes/RoundRectShape.java
@@ -57,13 +57,11 @@ public class RoundRectShape extends RectShape {
*/
public RoundRectShape(float[] outerRadii, RectF inset,
float[] innerRadii) {
- if (outerRadii.length < 8) {
- throw new ArrayIndexOutOfBoundsException(
- "outer radii must have >= 8 values");
+ if (outerRadii != null && outerRadii.length < 8) {
+ throw new ArrayIndexOutOfBoundsException("outer radii must have >= 8 values");
}
if (innerRadii != null && innerRadii.length < 8) {
- throw new ArrayIndexOutOfBoundsException(
- "inner radii must have >= 8 values");
+ throw new ArrayIndexOutOfBoundsException("inner radii must have >= 8 values");
}
mOuterRadii = outerRadii;
mInset = inset;
@@ -97,8 +95,7 @@ public class RoundRectShape extends RectShape {
r.right - mInset.right, r.bottom - mInset.bottom);
if (mInnerRect.width() < w && mInnerRect.height() < h) {
if (mInnerRadii != null) {
- mPath.addRoundRect(mInnerRect, mInnerRadii,
- Path.Direction.CCW);
+ mPath.addRoundRect(mInnerRect, mInnerRadii, Path.Direction.CCW);
} else {
mPath.addRect(mInnerRect, Path.Direction.CCW);
}
@@ -109,8 +106,8 @@ public class RoundRectShape extends RectShape {
@Override
public RoundRectShape clone() throws CloneNotSupportedException {
RoundRectShape shape = (RoundRectShape) super.clone();
- shape.mOuterRadii = mOuterRadii.clone();
- shape.mInnerRadii = mInnerRadii.clone();
+ shape.mOuterRadii = mOuterRadii != null ? mOuterRadii.clone() : null;
+ shape.mInnerRadii = mInnerRadii != null ? mInnerRadii.clone() : null;
shape.mInset = new RectF(mInset);
shape.mInnerRect = new RectF(mInnerRect);
shape.mPath = new Path(mPath);