summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoahelpers.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoahelpers.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 8ad80333f8..f51c21ee9b 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -634,10 +634,14 @@ QString qt_mac_applicationName()
int qt_mac_mainScreenHeight()
{
QMacAutoReleasePool pool;
- // The first screen in the screens array is documented
- // to have the (0,0) origin.
- NSRect screenFrame = [[[NSScreen screens] firstObject] frame];
- return screenFrame.size.height;
+ NSArray *screens = [NSScreen screens];
+ if ([screens count] > 0) {
+ // The first screen in the screens array is documented
+ // to have the (0,0) origin.
+ NSRect screenFrame = [[screens objectAtIndex: 0] frame];
+ return screenFrame.size.height;
+ }
+ return 0;
}
int qt_mac_flipYCoordinate(int y)