Add basic argument checks for glfwSetWindowMonitor

This commit is contained in:
Camilla Berglund 2016-05-22 14:25:37 +02:00
parent 325729d0f6
commit 57f4ba7b37

View File

@ -737,6 +737,22 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* wh,
_GLFW_REQUIRE_INIT(); _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.width = width;
window->videoMode.height = height; window->videoMode.height = height;
window->videoMode.refreshRate = refreshRate; window->videoMode.refreshRate = refreshRate;