diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Rect.java | 12 | ||||
-rw-r--r-- | graphics/java/android/graphics/RectF.java | 24 |
2 files changed, 24 insertions, 12 deletions
diff --git a/graphics/java/android/graphics/Rect.java b/graphics/java/android/graphics/Rect.java index 6c204ab..8b5609f 100644 --- a/graphics/java/android/graphics/Rect.java +++ b/graphics/java/android/graphics/Rect.java @@ -69,10 +69,14 @@ public final class Rect implements Parcelable { * rectangle. */ public Rect(Rect r) { - left = r.left; - top = r.top; - right = r.right; - bottom = r.bottom; + if (r == null) { + left = top = right = bottom = 0; + } else { + left = r.left; + top = r.top; + right = r.right; + bottom = r.bottom; + } } @Override diff --git a/graphics/java/android/graphics/RectF.java b/graphics/java/android/graphics/RectF.java index 108b7f9..53178b0 100644 --- a/graphics/java/android/graphics/RectF.java +++ b/graphics/java/android/graphics/RectF.java @@ -66,17 +66,25 @@ public class RectF implements Parcelable { * rectangle. */ public RectF(RectF r) { - left = r.left; - top = r.top; - right = r.right; - bottom = r.bottom; + if (r == null) { + left = top = right = bottom = 0.0f; + } else { + left = r.left; + top = r.top; + right = r.right; + bottom = r.bottom; + } } public RectF(Rect r) { - left = r.left; - top = r.top; - right = r.right; - bottom = r.bottom; + if (r == null) { + left = top = right = bottom = 0.0f; + } else { + left = r.left; + top = r.top; + right = r.right; + bottom = r.bottom; + } } @Override |