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

Commit f87b174d authored by Benjamin Franz's avatar Benjamin Franz
Browse files

Avoid NullPointerException if createUser returns null

If createUser returns null, we run into a NullPointerException
in createAndInitializeUser. This can happen when the policy
DISALLOW_ADD_USER is set.

Bug: 19121141
Change-Id: Id4bda832a243fa42c31eb5a176ecaa248aee68f5
parent 266303fd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4734,6 +4734,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
    public UserHandle createAndInitializeUser(ComponentName who, String name,
            String ownerName, ComponentName profileOwnerComponent, Bundle adminExtras) {
        UserHandle user = createUser(who, name);
        if (user == null) {
            return null;
        }
        long id = Binder.clearCallingIdentity();
        try {
            String profileOwnerPkg = profileOwnerComponent.getPackageName();