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

Commit 1c09db21 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Check for null values when copying enforcedAdmin in QSTile.State.

Bug: 26612685
Change-Id: I8228d1dffc3623d3589b51c6c33f07cc53605ef2
parent 16548a3e
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -233,6 +233,16 @@ public class RestrictedLockUtils {
            this.userId = userId;
            this.userId = userId;
        }
        }


        public EnforcedAdmin(EnforcedAdmin other) {
            if (other == null) {
                throw new IllegalArgumentException();
            }
            this.component = other.component;
            this.userId = other.userId;
        }

        public EnforcedAdmin() {}

        @Override
        @Override
        public boolean equals(Object object) {
        public boolean equals(Object object) {
            if (object == this) return true;
            if (object == this) return true;
@@ -255,12 +265,10 @@ public class RestrictedLockUtils {


        public void copyTo(EnforcedAdmin other) {
        public void copyTo(EnforcedAdmin other) {
            if (other == null) {
            if (other == null) {
                other = new EnforcedAdmin();
                throw new IllegalArgumentException();
            }
            }
            other.component = component;
            other.component = component;
            other.userId = userId;
            other.userId = userId;
        }
        }

        public EnforcedAdmin() {}
    }
    }
}
}
 No newline at end of file
+7 −1
Original line number Original line Diff line number Diff line
@@ -480,7 +480,13 @@ public abstract class QSTile<TState extends State> implements Listenable {
            other.dualLabelContentDescription = dualLabelContentDescription;
            other.dualLabelContentDescription = dualLabelContentDescription;
            other.autoMirrorDrawable = autoMirrorDrawable;
            other.autoMirrorDrawable = autoMirrorDrawable;
            other.disabledByPolicy = disabledByPolicy;
            other.disabledByPolicy = disabledByPolicy;
            if (enforcedAdmin == null) {
                other.enforcedAdmin = null;
            } else if (other.enforcedAdmin == null) {
                other.enforcedAdmin = new EnforcedAdmin(enforcedAdmin);
            } else {
                enforcedAdmin.copyTo(other.enforcedAdmin);
                enforcedAdmin.copyTo(other.enforcedAdmin);
            }
            return changed;
            return changed;
        }
        }