summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 35624d3..8708487 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -127,10 +127,14 @@ void RenderViewContextMenu::AppendSearchProvider() {
const TemplateURL* const default_provider =
profile_->GetTemplateURLModel()->GetDefaultSearchProvider();
if (default_provider != NULL) {
- std::wstring label(l10n_util::GetStringF(IDS_CONTENT_CONTEXT_SEARCHWEBFOR,
- default_provider->short_name(),
- l10n_util::TruncateString(params_.selection_text, 50)));
- AppendMenuItem(IDS_CONTENT_CONTEXT_SEARCHWEBFOR, label);
+ std::wstring selection_text =
+ l10n_util::TruncateString(params_.selection_text, 50);
+ if (!selection_text.empty()) {
+ std::wstring label(l10n_util::GetStringF(IDS_CONTENT_CONTEXT_SEARCHWEBFOR,
+ default_provider->short_name(),
+ selection_text));
+ AppendMenuItem(IDS_CONTENT_CONTEXT_SEARCHWEBFOR, label);
+ }
}
}