Don't crash when copying a null Rect
Bug #7158068 Change-Id: I8f5f3ee12b2c4fd1fe28212b0c6de1214f2ce5f9
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user