summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2014-02-10 13:43:18 -0800
committerAmith Yamasani <yamasani@google.com>2014-02-10 13:43:18 -0800
commit9348ac8249d2ef8d935e98053e5d135a2ff1ebcc (patch)
tree813c6f6107116736dc75ee5bab575eb03c840309 /services/devicepolicy
parent976ed212158ec5704c9e7d179048b0fb985e7667 (diff)
downloadframeworks_base-9348ac8249d2ef8d935e98053e5d135a2ff1ebcc.zip
frameworks_base-9348ac8249d2ef8d935e98053e5d135a2ff1ebcc.tar.gz
frameworks_base-9348ac8249d2ef8d935e98053e5d135a2ff1ebcc.tar.bz2
Fix NPE on removing a user
Bug: 12957232 Check for null mDeviceOwner. Change-Id: I107dc24d1a8de121ebd2c1bb56e1af40bb1c55ac
Diffstat (limited to 'services/devicepolicy')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index a8f2df1..5a964ad 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -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) {