summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_popup_model.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 00:48:00 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 00:48:00 +0000
commitfc54587119c1854219ccdf888699d2a0981e93e2 (patch)
tree3853d886258d70c0c1b07af36386ebc32b54585a /chrome/browser/autocomplete/autocomplete_popup_model.cc
parentb81fce4b98f01f22ed904b7c83ad080dd3f8aa71 (diff)
downloadchromium_src-fc54587119c1854219ccdf888699d2a0981e93e2.zip
chromium_src-fc54587119c1854219ccdf888699d2a0981e93e2.tar.gz
chromium_src-fc54587119c1854219ccdf888699d2a0981e93e2.tar.bz2
Add a couple CHECK()s in hopes of helping to track down a crash.
BUG=13500 TEST=none Review URL: http://codereview.chromium.org/118453 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18128 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_popup_model.cc')
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_model.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.cc b/chrome/browser/autocomplete/autocomplete_popup_model.cc
index 21e28c7..4de6298 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_model.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_model.cc
@@ -129,6 +129,11 @@ void AutocompletePopupModel::SetSelectedLine(size_t line,
// call us back to get data about the old selection), and we must not call
// UpdateWindow() before updating |selected_line_| (since the paint routine
// relies on knowing the correct selected line).
+ //
+ // NOTE: We should never reach here with no selected line; the same code that
+ // opened the popup and made it possible to get here should have also set a
+ // selected line.
+ CHECK(selected_line_ != kNoMatch);
view_->InvalidateLine(selected_line_);
selected_line_ = line;
view_->InvalidateLine(selected_line_);
@@ -308,6 +313,8 @@ void AutocompletePopupModel::Observe(NotificationType type,
case NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED: {
selected_line_ = (result->default_match() == result->end()) ?
kNoMatch : (result->default_match() - result->begin());
+ // There had better not be a nonempty result set with no default match.
+ CHECK((selected_line_ != kNoMatch) || result->empty());
// If we're going to trim the window size to no longer include the hovered
// line, turn hover off. Practically, this shouldn't happen, but it
// doesn't hurt to be defensive.