summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy/java
diff options
context:
space:
mode:
authorBenjamin Franz <bfranz@google.com>2015-01-23 15:32:30 +0000
committerBenjamin Franz <bfranz@google.com>2015-01-23 17:04:16 +0000
commitf87b174dac87ed9e95e8522bfb836707f4a2239d (patch)
tree1be6d419c6c79a3b394fceba034a9a074f791bfe /services/devicepolicy/java
parent266303fdb02ca1cf6df348e1af6830675476fd78 (diff)
downloadframeworks_base-f87b174dac87ed9e95e8522bfb836707f4a2239d.zip
frameworks_base-f87b174dac87ed9e95e8522bfb836707f4a2239d.tar.gz
frameworks_base-f87b174dac87ed9e95e8522bfb836707f4a2239d.tar.bz2
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
Diffstat (limited to 'services/devicepolicy/java')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 2ca5629..2ffc963 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -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();