OSDN Git Service

Fix NPE in DevicePolicyManagerService that crashed SystemUI
authorAdrian Roos <roosa@google.com>
Thu, 7 Aug 2014 13:55:18 +0000 (15:55 +0200)
committerThe Android Automerger <android-build@android.com>
Thu, 7 Aug 2014 18:51:13 +0000 (11:51 -0700)
Bug: 16857795
Change-Id: I6234f03c4ee31311af9f9c556b790594ee1a8b2f

services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java

index 8e59844..fc96991 100644 (file)
@@ -2850,7 +2850,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                 if (mHasFeature) {
                     ActiveAdmin strictestAdmin =
                             getAdminWithMinimumFailedPasswordsForWipeLocked(userHandle);
-                    int max = strictestAdmin.maximumFailedPasswordsForWipe;
+                    int max = strictestAdmin != null
+                            ? strictestAdmin.maximumFailedPasswordsForWipe : 0;
                     if (max > 0 && policy.mFailedPasswordAttempts >= max) {
                         // Wipe the user/profile associated with the policy that was violated. This
                         // is not necessarily calling user: if the policy that fired was from a