summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 21:53:04 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 21:53:04 +0000
commitbc90a55d0dd209e0d3a1c719f54226becb045dd8 (patch)
tree68dfde948cdc813986f93d969f0c77c0f8bc451c /chrome/views
parent31fb110528230784dc006c182edfa1003a2b9be8 (diff)
downloadchromium_src-bc90a55d0dd209e0d3a1c719f54226becb045dd8.zip
chromium_src-bc90a55d0dd209e0d3a1c719f54226becb045dd8.tar.gz
chromium_src-bc90a55d0dd209e0d3a1c719f54226becb045dd8.tar.bz2
Fixes crash in adding a menu item. As far as I can tell
l10n_util::GetString(IDS_TASK_MANAGER) is returning "". Tony, myself and Rahul don't think this should be possible, yet we have crashes indicating otherwise. If IDS_TASK_MANAGER returns an emtpy string then menu derefs NULL and we crash. BUG=6206 TEST=no way to directly test this, instead just make sure menus still work. Review URL: http://codereview.chromium.org/19434 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8829 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/menu.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/views/menu.cc b/chrome/views/menu.cc
index b064e72..d50404b 100644
--- a/chrome/views/menu.cc
+++ b/chrome/views/menu.cc
@@ -267,6 +267,15 @@ void Menu::AddMenuItemInternal(int index,
MenuItemType type) {
DCHECK(type != SEPARATOR) << "Call AddSeparator instead!";
+ if (label.empty() && !delegate_) {
+ // No label and no delegate; don't add an empty menu.
+ // It appears under some circumstance we're getting an empty label
+ // (l10n_util::GetString(IDS_TASK_MANAGER) returns ""). This shouldn't
+ // happen, but I'm working over the crash here.
+ NOTREACHED();
+ return;
+ }
+
MENUITEMINFO mii;
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_FTYPE | MIIM_ID;