Index: components/omnibox/browser/autocomplete_result.cc |
diff --git a/components/omnibox/browser/autocomplete_result.cc b/components/omnibox/browser/autocomplete_result.cc |
index 14f084337e980300abdaf7d6df4ba3b249b8374d..9aa9815358303c2b6d6aeef42b3c658805c943e1 100644 |
--- a/components/omnibox/browser/autocomplete_result.cc |
+++ b/components/omnibox/browser/autocomplete_result.cc |
@@ -166,11 +166,20 @@ void AutocompleteResult::SortAndCull( |
: base::string16()) + |
base::ASCIIToUTF16(", input=") + |
input.text(); |
- DCHECK(default_match_->allowed_to_be_default_match) << debug_info; |
- // If the default match is valid (i.e., not a prompt/placeholder), make |
- // sure the type of destination is what the user would expect given the |
- // input. |
- if (default_match_->destination_url.is_valid()) { |
+ |
+ // We should only get here with an empty omnibox for automatic suggestions |
+ // on focus on the NTP; in these cases hitting enter should do nothing, so |
+ // there should be no default match. Otherwise, we're doing automatic |
+ // suggestions for the currently visible URL (and hitting enter should |
+ // reload it), or the user is typing; in either of these cases, there should |
+ // be a default match. |
+ DCHECK_NE(input.text().empty(), default_match_->allowed_to_be_default_match) |
+ << debug_info; |
+ |
+ // For navigable default matches, make sure the destination type is what the |
+ // user would expect given the input. |
+ if (default_match_->allowed_to_be_default_match && |
+ default_match_->destination_url.is_valid()) { |
if (AutocompleteMatch::IsSearchType(default_match_->type)) { |
// We shouldn't get query matches for URL inputs. |
DCHECK_NE(metrics::OmniboxInputType::URL, input.type()) << debug_info; |