summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-09-12 17:28:02 -0700
committerRomain Guy <romainguy@google.com>2012-09-12 17:28:02 -0700
commitdd4b1fec4c93c7417314febecebfd91e916f5ff6 (patch)
tree381b9091e8f84dda4cb70dd0911951a7002ea934 /graphics
parentc7b6ec7a7c8ee33278baddb0889d67042f38daef (diff)
downloadframeworks_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.java12
-rw-r--r--graphics/java/android/graphics/RectF.java24
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