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

Unified Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc

Issue 2766263007: Verify that previous_selected_line is within bounds before passing to (Closed)
Patch Set: Created 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
index b800e88cc141934f36e113db3cb1c86beb358449..619b9dd5078443e07f089538a73883c1481cf7bf 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -398,7 +398,11 @@ void AutofillPopupControllerImpl::SetSelectedLine(
selected_line = base::nullopt;
}
- auto previous_selected_line(selected_line_);
+ base::Optional<int> previous_selected_line;
+ if (selected_line_ && *selected_line_ < suggestions_.size()) {
+ previous_selected_line = selected_line_;
+ }
+
selected_line_ = selected_line;
view_->OnSelectedRowChanged(previous_selected_line, selected_line_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698