summaryrefslogtreecommitdiff
path: root/vcl/osx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-02 20:07:14 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-02 20:09:25 +0100
commit1ab135c3621e4be9f48754d300e5cd57cb446184 (patch)
treea636cb36da95e128598434602ebedd0fc9b90ff6 /vcl/osx
parentae78051c22d5a9bc7b5728482d59720fed7e6146 (diff)
Handle case that pDock may have no items
...in code introduced with be1b03a4b0f61b49a3aba8d6b78ae69be7295785 "dock icon's menu doesn't begin with separator anymore," causing CppunitTest_vcl_lifecycle to fail Change-Id: If6eb1f3a0f52d05284ac01f448888aaaa7523a98
Diffstat (limited to 'vcl/osx')
-rw-r--r--vcl/osx/salframe.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 8634ce9ee0df..c4614a821c1d 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -118,8 +118,11 @@ AquaSalFrame::~AquaSalFrame()
NSMenu* pDock = AquaSalInstance::GetDynamicDockMenu();
// life cycle comment: the menu has ownership of the item, so no release
[pDock removeItem: mpDockMenuEntry];
- if ( [[pDock itemAtIndex: 0] isSeparatorItem] )
+ if ([pDock numberOfItems] != 0
+ && [[pDock itemAtIndex: 0] isSeparatorItem])
+ {
[pDock removeItemAtIndex: 0];
+ }
}
if ( mpNSView ) {
[AquaA11yFactory revokeView: mpNSView];
@@ -304,9 +307,11 @@ void AquaSalFrame::SetTitle(const OUString& rTitle)
{
NSMenu* pDock = AquaSalInstance::GetDynamicDockMenu();
- NSMenuItem* pTopItem = [pDock itemAtIndex: 0];
- if ( [pTopItem hasSubmenu] )
- [pDock insertItem: [NSMenuItem separatorItem] atIndex: 0];
+ if ([pDock numberOfItems] != 0) {
+ NSMenuItem* pTopItem = [pDock itemAtIndex: 0];
+ if ( [pTopItem hasSubmenu] )
+ [pDock insertItem: [NSMenuItem separatorItem] atIndex: 0];
+ }
mpDockMenuEntry = [pDock insertItemWithTitle: pTitle
action: @selector(dockMenuItemTriggered:)