From a98b1877aaed1654cd008c6ddffe9c3ea10ebc52 Mon Sep 17 00:00:00 2001 From: Scr3amer Date: Tue, 26 Sep 2023 14:51:54 -0400 Subject: [PATCH] Return NULL if the monitor is not found --- include/GLFW/glfw3.h | 2 ++ src/win32_window.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 1aae0a55..6ef01bf9 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -3903,6 +3903,8 @@ GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window); * The window should not be NULL. * * @param[in] window The window to query. + * @return The monitor, or `NULL` if the window is NULL or an + * [error](@ref error_handling) occurred. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * diff --git a/src/win32_window.c b/src/win32_window.c index 55d0ab9c..f81999a2 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1772,7 +1772,7 @@ _GLFWmonitor* _glfwGetMonitorDisplayingWindowWin32(_GLFWwindow* window) return _glfw.monitors[i]; } - return _glfw.monitors[0]; + return NULL; } void _glfwFocusWindowWin32(_GLFWwindow* window)