Fix NPE on removing a user

Bug: 12957232

Check for null mDeviceOwner.

Change-Id: I107dc24d1a8de121ebd2c1bb56e1af40bb1c55ac
This commit is contained in:
Amith Yamasani
2014-02-10 13:43:18 -08:00
parent 976ed21215
commit 9348ac8249

View File

@@ -599,9 +599,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
Slog.w(LOG_TAG, "Tried to remove device policy file for user 0! Ignoring.");
return;
}
mDeviceOwner.removeProfileOwner(userHandle);
mDeviceOwner.writeOwnerFile();
if (mDeviceOwner != null) {
mDeviceOwner.removeProfileOwner(userHandle);
mDeviceOwner.writeOwnerFile();
}
DevicePolicyData policy = mUserData.get(userHandle);
if (policy != null) {