From 57f4ba7b37fb0e898ca608020d879bf36a2872bf Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 22 May 2016 14:25:37 +0200 Subject: [PATCH] Add basic argument checks for glfwSetWindowMonitor --- src/window.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/window.c b/src/window.c index 9edc864d..7a881060 100644 --- a/src/window.c +++ b/src/window.c @@ -737,6 +737,22 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* wh, _GLFW_REQUIRE_INIT(); + if (width <= 0 || height <= 0) + { + _glfwInputError(GLFW_INVALID_VALUE, + "Invalid window size %ix%i", + width, height); + return; + } + + if (refreshRate < 0 && refreshRate != GLFW_DONT_CARE) + { + _glfwInputError(GLFW_INVALID_VALUE, + "Invalid refresh rate %i", + refreshRate); + return; + } + window->videoMode.width = width; window->videoMode.height = height; window->videoMode.refreshRate = refreshRate;