Fixed NPE in canAddMoreManagedProfiles

We can use the command 'adb shell pm create-user --profileOf -10000
--managed TestProfile_12345678' to reproduce the problem.

Signed-off-by: yuanhao <yuanhao@xiaomi.com>
This commit is contained in:
yuanhao
2017-01-18 09:54:45 +08:00
committed by 浩 袁
parent 32aac7b9c9
commit 47f9f7cbcb

View File

@@ -1443,7 +1443,7 @@ public class UserManagerService extends IUserManager.Stub {
}
synchronized(mUsersLock) {
UserInfo userInfo = getUserInfoLU(userId);
if (!userInfo.canHaveProfile()) {
if (userInfo == null || !userInfo.canHaveProfile()) {
return false;
}
int usersCountAfterRemoving = getAliveUsersExcludingGuestsCountLU()