From f7733c7b4f8b0059b43c9ddd847b4f6b8604881f Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Sat, 8 Sep 2018 17:14:57 +0200 Subject: [PATCH] Win32: Add missing out parameter NULL checks This fixes _glfwPlatformGetMonitorWorkarea not checking if its out parameters were NULL. Related to #1322. --- src/win32_monitor.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/win32_monitor.c b/src/win32_monitor.c index a8a35250..13ceadf8 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -377,10 +377,14 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos hMonitor = MonitorFromPoint( pointInMonitor, 0 ); GetMonitorInfo(hMonitor, &monitorInfo); - *xpos = monitorInfo.rcWork.left; - *ypos = monitorInfo.rcWork.top; - *width = monitorInfo.rcWork.right - monitorInfo.rcWork.left; - *height = monitorInfo.rcWork.bottom - monitorInfo.rcWork.top; + if (xpos) + *xpos = monitorInfo.rcWork.left; + if (ypos) + *ypos = monitorInfo.rcWork.top; + if (width) + *width = monitorInfo.rcWork.right - monitorInfo.rcWork.left; + if (height) + *height = monitorInfo.rcWork.bottom - monitorInfo.rcWork.top; } GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)