diff options
author | Romain Guy <romainguy@google.com> | 2012-09-12 17:28:02 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-09-12 17:28:02 -0700 |
commit | dd4b1fec4c93c7417314febecebfd91e916f5ff6 (patch) | |
tree | 381b9091e8f84dda4cb70dd0911951a7002ea934 /graphics | |
parent | c7b6ec7a7c8ee33278baddb0889d67042f38daef (diff) | |
download | frameworks_base-dd4b1fec4c93c7417314febecebfd91e916f5ff6.zip frameworks_base-dd4b1fec4c93c7417314febecebfd91e916f5ff6.tar.gz frameworks_base-dd4b1fec4c93c7417314febecebfd91e916f5ff6.tar.bz2 |
Don't crash when copying a null Rect
Bug #7158068
Change-Id: I8f5f3ee12b2c4fd1fe28212b0c6de1214f2ce5f9
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 |