Fix order of error checks in glfwSetGammaRamp

Initialization should be checked before arguments.

(cherry picked from commit 29523dbfbf)
This commit is contained in:
Camilla Löwy
2022-04-21 15:37:31 +02:00
parent 4143d96228
commit af612103d0
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -521,6 +521,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,
@@ -529,8 +531,6 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
return;
}
_GLFW_REQUIRE_INIT();
if (!monitor->originalRamp.size)
{
if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp))