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

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

Issue 1839763008: [Autofill] Correctly fill month selects where the first value is negative. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_field_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_field.cc
diff --git a/components/autofill/core/browser/autofill_field.cc b/components/autofill/core/browser/autofill_field.cc
index 7ec8ebefa5498b816026a07126cc464a92de25e5..fbdcfc8fa7e4a2907284976ebe5b70ef734a4f79 100644
--- a/components/autofill/core/browser/autofill_field.cc
+++ b/components/autofill/core/browser/autofill_field.cc
@@ -214,9 +214,9 @@ bool FillExpirationMonthSelectControl(const base::string16& value,
} else if (trimmed_values.size() == 13) {
// The select presumably uses the first value as a placeholder.
int first_value;
- // If the first value is not a number. Check the second value and apply the
- // same logic as if there was no placeholder.
- if (!StringToInt(trimmed_values[0], &first_value)) {
+ // If the first value is not a number or is a negative one, check the second
+ // value and apply the same logic as if there was no placeholder.
+ if (!StringToInt(trimmed_values[0], &first_value) || first_value < 0) {
int second_value;
if (StringToInt(trimmed_values[1], &second_value) && second_value == 0)
--month;
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698