From 222ac78a44457433871b65879583bb47a78fa19e Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Sat, 8 Sep 2018 18:00:44 +0200 Subject: [PATCH] Cocoa: Add work area NULL checks and fix size Related to #1322. --- src/cocoa_monitor.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cocoa_monitor.m b/src/cocoa_monitor.m index 736a9053..e4eb12d1 100644 --- a/src/cocoa_monitor.m +++ b/src/cocoa_monitor.m @@ -420,10 +420,14 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos NSRect frameRect = [[NSScreen resultScreen] visibleFrame]; - *xpos = NSMinX(frameRect); - *ypos = NSMinY(frameRect); - *width = NSMaxX(frameRect); - *height = NSMaxY(frameRect); + if (xpos) + *xpos = NSMinX(frameRect); + if (ypos) + *ypos = NSMinY(frameRect); + if (width) + *width = NSWidth(frameRect); + if (height) + *height = NSHeight(frameRect); } GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)