Skip to content

Commit 0f2fa0a

Browse files
committed
Fix NPE at the end of PO provisioning
Change-Id: I1eaa2111a0b8533800c5c8843c35473ad419548b Fixes: 65724674
1 parent 5b5ee0d commit 0f2fa0a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

app/src/main/java/com/afwsamples/testdpc/provision/PostProvisioningTask.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,14 @@ public boolean performPostProvisioningOperations(Intent intent) {
103103

104104
// If TestDPC asked GmsCore to store its state in the FRP area before factory reset, the
105105
// state will be handed over to it during the next device setup.
106-
if (BuildCompat.isAtLeastOMR1() && extras.containsKey(KEY_DEVICE_OWNER_STATE)) {
106+
if (BuildCompat.isAtLeastOMR1()
107+
&& extras != null
108+
&& extras.containsKey(KEY_DEVICE_OWNER_STATE)) {
107109
Util.setPersistentDoStateWithApplicationRestriction(
108-
mContext,
109-
mDevicePolicyManager,
110-
DeviceAdminReceiver.getComponentName(mContext),
111-
extras.getString(KEY_DEVICE_OWNER_STATE));
110+
mContext,
111+
mDevicePolicyManager,
112+
DeviceAdminReceiver.getComponentName(mContext),
113+
extras.getString(KEY_DEVICE_OWNER_STATE));
112114
}
113115

114116
// Hide the setup launcher when this app is the admin

0 commit comments

Comments
 (0)