Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd4b1fec authored by Romain Guy's avatar Romain Guy
Browse files

Don't crash when copying a null Rect

Bug #7158068

Change-Id: I8f5f3ee12b2c4fd1fe28212b0c6de1214f2ce5f9
parent c7b6ec7a
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -69,11 +69,15 @@ public final class Rect implements Parcelable {
     *          rectangle.
     */
    public Rect(Rect r) {
        if (r == null) {
            left = top = right = bottom = 0;
        } else {
            left = r.left;
            top = r.top;
            right = r.right;
            bottom = r.bottom;
        }
    }

    @Override
    public boolean equals(Object o) {
+16 −8
Original line number Diff line number Diff line
@@ -66,18 +66,26 @@ public class RectF implements Parcelable {
     *          rectangle.
     */
    public RectF(RectF r) {
        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) {
        if (r == null) {
            left = top = right = bottom = 0.0f;
        } else {
            left = r.left;
            top = r.top;
            right = r.right;
            bottom = r.bottom;
        }
    }

    @Override
    public boolean equals(Object o) {