Only delete the current AutoFill profile if one has been set already.
Fix for NPE if the user tries to delete an AutoFill profile before
one has been set.
Bug: 3198437
Change-Id: I8e836a34f15b52b5dd850778a6dcee466ca91825
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 776f4b0..069f886 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -547,8 +547,10 @@
new SaveProfileToDbTask(ctx, msg).execute(profile);
} else {
// Delete the current profile.
- new DeleteProfileFromDbTask(ctx, msg).execute(autoFillProfile.getUniqueId());
- setActiveAutoFillProfileId(ctx, NO_AUTOFILL_PROFILE_SET);
+ if (autoFillProfile != null) {
+ new DeleteProfileFromDbTask(ctx, msg).execute(autoFillProfile.getUniqueId());
+ setActiveAutoFillProfileId(ctx, NO_AUTOFILL_PROFILE_SET);
+ }
}
autoFillProfile = profile;
}