summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-02-14 19:50:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-18 13:43:21 +0100
commit7c33ae6a7bbbd42ce70acf77aa55c1bc2a23c8ec (patch)
tree249e807dc153d43e6b7e69f4549e8918a25dc763 /src/plugins/platforms/cocoa
parentc7a51f1858a8cac5cdc458b575df1f0e064e3853 (diff)
Cocoa QPA: Make QCocoaMenu::menuItemAt() more robust
Change-Id: I2c68f87eb1a4926ca5bd0bfcc842ab9c56c99cd7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index a92f4e875c..0fe4c48510 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -322,7 +322,10 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf
QPlatformMenuItem *QCocoaMenu::menuItemAt(int position) const
{
- return m_menuItems.at(position);
+ if (0 <= position && position < m_menuItems.count())
+ return m_menuItems.at(position);
+
+ return 0;
}
QPlatformMenuItem *QCocoaMenu::menuItemForTag(quintptr tag) const