From 61e2d2350260f7c9c1bb77eae67c6698295c4995 Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Sat, 8 Sep 2018 18:00:44 +0200 Subject: [PATCH] Added cocoa NULL argument checks and fixed height/width issue. --- 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 3b38a15b0..b8602a016 100644 --- a/src/cocoa_monitor.m +++ b/src/cocoa_monitor.m @@ -372,10 +372,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)