Skip to content

Commit

Permalink
Remove NOTREACHED() in the RawInfo accessors of AutfillProfile.
Browse files Browse the repository at this point in the history
Reverts the NOTREACHED() statements recently added in
crrev.com/c/3528474.

While the RawInfo accessors should ideally not be called with field
types unassociated with the AutofillProfile, the usage of
GetInfo/GetRawInfo is inconsistent for historical reasons. The
NOREACHED() statements can therefore lead to unexpected crashes.

(cherry picked from commit 9a0ed6a)

Bug: 1327588
Change-Id: Ie241e84b8b3d8f9d3003516da91cdfeba4f5908a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655466
Commit-Queue: Matthias Körber <koerber@google.com>
Reviewed-by: Matthias Körber <koerber@google.com>
Commit-Queue: Florian Leimgruber <fleimgruber@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#1005718}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3660084
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Christoph Schwering <schwering@google.com>
Auto-Submit: Florian Leimgruber <fleimgruber@google.com>
Cr-Commit-Position: refs/branch-heads/5060@{#176}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
florianleimgruber authored and Chromium LUCI CQ committed May 23, 2022
1 parent 1f67dd1 commit 99f99a1
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions components/autofill/core/browser/data_model/autofill_profile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,19 +320,15 @@ void AutofillProfile::GetMatchingTypes(

std::u16string AutofillProfile::GetRawInfo(ServerFieldType type) const {
const FormGroup* form_group = FormGroupForType(AutofillType(type));
if (!form_group) {
NOTREACHED();
if (!form_group)
return std::u16string();
}
return form_group->GetRawInfo(type);
}

int AutofillProfile::GetRawInfoAsInt(ServerFieldType type) const {
const FormGroup* form_group = FormGroupForType(AutofillType(type));
if (!form_group) {
NOTREACHED();
if (!form_group)
return 0;
}
return form_group->GetRawInfoAsInt(type);
}

Expand All @@ -341,23 +337,19 @@ void AutofillProfile::SetRawInfoWithVerificationStatus(
const std::u16string& value,
VerificationStatus status) {
FormGroup* form_group = MutableFormGroupForType(AutofillType(type));
if (!form_group) {
NOTREACHED();
return;
if (form_group) {
form_group->SetRawInfoWithVerificationStatus(type, value, status);
}
form_group->SetRawInfoWithVerificationStatus(type, value, status);
}

void AutofillProfile::SetRawInfoAsIntWithVerificationStatus(
ServerFieldType type,
int value,
VerificationStatus status) {
FormGroup* form_group = MutableFormGroupForType(AutofillType(type));
if (!form_group) {
NOTREACHED();
return;
if (form_group) {
form_group->SetRawInfoAsIntWithVerificationStatus(type, value, status);
}
form_group->SetRawInfoAsIntWithVerificationStatus(type, value, status);
}

void AutofillProfile::GetSupportedTypes(
Expand Down

0 comments on commit 99f99a1

Please sign in to comment.