Переглянути джерело

Fix gamma test not checking for NULL return value

Camilla Löwy 3 роки тому
батько
коміт
8aaea57421
1 змінених файлів з 6 додано та 0 видалено
  1. 6 0
      tests/gamma.c

+ 6 - 0
tests/gamma.c

@@ -113,6 +113,12 @@ int main(int argc, char** argv)
 
 
     {
     {
         const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
         const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
+        if (!ramp)
+        {
+            glfwTerminate();
+            exit(EXIT_FAILURE);
+        }
+
         const size_t array_size = ramp->size * sizeof(short);
         const size_t array_size = ramp->size * sizeof(short);
         orig_ramp.size = ramp->size;
         orig_ramp.size = ramp->size;
         orig_ramp.red = malloc(array_size);
         orig_ramp.red = malloc(array_size);