Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Unified Diff: components/autofill/core/browser/autofill_country.cc

Issue 298863012: Use upstream libaddressinput in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_country.cc
diff --git a/components/autofill/core/browser/autofill_country.cc b/components/autofill/core/browser/autofill_country.cc
index d31ac6c1a0a659168f8552145e5643d0d0bbdf38..2e0be52843a617c61ca2c336ba0535196068086f 100644
--- a/components/autofill/core/browser/autofill_country.cc
+++ b/components/autofill/core/browser/autofill_country.cc
@@ -1044,15 +1044,18 @@ const std::string CountryNames::GetSortKey(const icu::Collator& collator,
AutofillCountry::AutofillCountry(const std::string& country_code,
const std::string& locale) {
- const CountryDataMap::Iterator result = CountryDataMap::Find(country_code);
- DCHECK(result != CountryDataMap::End());
- const CountryData& data = result->second;
-
country_code_ = country_code;
name_ = l10n_util::GetDisplayNameForCountry(country_code, locale);
- postal_code_label_ = l10n_util::GetStringUTF16(data.postal_code_label_id);
- state_label_ = l10n_util::GetStringUTF16(data.state_label_id);
- address_required_fields_ = data.address_required_fields;
+
+ const CountryDataMap::Iterator result = CountryDataMap::Find(country_code);
+ if (result != CountryDataMap::End()) {
+ const CountryData& data = result->second;
+ postal_code_label_ = l10n_util::GetStringUTF16(data.postal_code_label_id);
+ state_label_ = l10n_util::GetStringUTF16(data.state_label_id);
+ address_required_fields_ = data.address_required_fields;
+ } else {
+ postal_code_label_ = state_label_ = base::ASCIIToUTF16("[UNKNOWN]");
+ }
}
AutofillCountry::~AutofillCountry() {

Powered by Google App Engine
This is Rietveld 408576698