Fix order of error checks in glfwSetGammaRamp

Initialization should be checked before arguments.
This commit is contained in:
Camilla Löwy
2022-04-21 15:37:31 +02:00
parent f843d53333
commit 29523dbfbf
2 changed files with 3 additions and 2 deletions

View File

@@ -522,6 +522,8 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
assert(ramp->green != NULL);
assert(ramp->blue != NULL);
_GLFW_REQUIRE_INIT();
if (ramp->size <= 0)
{
_glfwInputError(GLFW_INVALID_VALUE,
@@ -530,8 +532,6 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
return;
}
_GLFW_REQUIRE_INIT();
if (!monitor->originalRamp.size)
{
if (!_glfw.platform.getGammaRamp(monitor, &monitor->originalRamp))