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

Unified Diff: chrome/browser/autocomplete/search_provider.cc

Issue 10392184: Fix possible crash in FinalizeInstantQuery() if AddMatchToMap() fails. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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
« 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/autocomplete/search_provider.cc
===================================================================
--- chrome/browser/autocomplete/search_provider.cc (revision 137999)
+++ chrome/browser/autocomplete/search_provider.cc (working copy)
@@ -136,6 +136,7 @@
&adjusted_input_text);
const string16 text = adjusted_input_text + suggest_text;
+ bool results_updated = false;
// Remove any matches that are identical to |text|. We don't use the
// destination_url for comparison as it varies depending upon the index passed
// to TemplateURL::ReplaceSearchTerms.
@@ -144,6 +145,7 @@
(i->type == AutocompleteMatch::SEARCH_SUGGEST)) &&
(i->fill_into_edit == text)) {
i = matches_.erase(i);
+ results_updated = true;
} else {
++i;
}
@@ -159,10 +161,13 @@
CalculateRelevanceForWhatYouTyped() + 1,
AutocompleteMatch::SEARCH_SUGGEST,
did_not_accept_default_suggestion, false, &match_map);
- DCHECK_EQ(1u, match_map.size());
- matches_.push_back(match_map.begin()->second);
+ if (!match_map.empty()) {
+ matches_.push_back(match_map.begin()->second);
+ results_updated = true;
+ }
- listener_->OnProviderUpdate(true);
+ if (results_updated || done_)
+ listener_->OnProviderUpdate(results_updated);
}
void SearchProvider::Start(const AutocompleteInput& input,
« 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