mirror of
https://github.com/glfw/glfw.git
synced 2024-11-29 21:37:27 +00:00
Add basic argument checks for glfwSetWindowMonitor
This commit is contained in:
parent
325729d0f6
commit
57f4ba7b37
16
src/window.c
16
src/window.c
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user