0

Fix AutofillAddress crash

AutofillAddress crashes when the AddressProfile is null. This CL adds
a null-check to avoid it.

Bug: 1227048
Change-Id: I128522cb85c11633f468f4e48bdc2d3f3b3d0480
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3010583
Reviewed-by: Nick Burris <nburris@chromium.org>
Reviewed-by: Liquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: Roger McFarlane <rogerm@chromium.org>
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900583}
This commit is contained in:
Liquan (Max) Gu
2021-07-12 19:18:21 +00:00
committed by Chromium LUCI CQ
parent 55176c28de
commit e4d8f80727

@@ -172,10 +172,13 @@ public class AutofillProfilesFragment extends PreferenceFragmentCompat
String guid = ((AutofillProfileEditorPreference) preference).getGUID(); String guid = ((AutofillProfileEditorPreference) preference).getGUID();
EditorDialog editorDialog = prepareEditorDialog(guid); EditorDialog editorDialog = prepareEditorDialog(guid);
mLastEditorDialogForTest = editorDialog; mLastEditorDialogForTest = editorDialog;
AutofillAddress autofillAddress = guid == null AutofillAddress autofillAddress = null;
? null if (guid != null) {
: new AutofillAddress( AutofillProfile profile = PersonalDataManager.getInstance().getProfile(guid);
getActivity(), PersonalDataManager.getInstance().getProfile(guid)); if (profile != null) {
autofillAddress = new AutofillAddress(getActivity(), profile);
}
}
editAddress(editorDialog, autofillAddress); editAddress(editorDialog, autofillAddress);
return; return;
} }