summaryrefslogtreecommitdiff
path: root/vcl/source/window/menu.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/window/menu.cxx')
-rw-r--r--vcl/source/window/menu.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 579e993e14a1..a93811d623b7 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -515,15 +515,21 @@ void Menu::InsertItem( const ResId& rResId )
void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::frame::XFrame>& rFrame)
{
- OUString aLabel(CommandInfoProvider::Instance().GetPopupLabelForCommand(rCommand, rFrame));
- OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
- Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, /*bLarge=*/ false, rFrame));
-
sal_uInt16 nItemId = GetItemCount() + 1;
- InsertItem(nItemId, aLabel, aImage);
+ if (rFrame.is())
+ {
+ OUString aLabel(CommandInfoProvider::Instance().GetPopupLabelForCommand(rCommand, rFrame));
+ OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
+ Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, /*bLarge=*/ false, rFrame));
+
+ InsertItem(nItemId, aLabel, aImage);
+ SetHelpText(nItemId, aTooltip);
+ }
+ else
+ InsertItem(nItemId, OUString());
+
SetItemCommand(nItemId, rCommand);
- SetHelpText(nItemId, aTooltip);
}