Forráskód Böngészése

Added allocation failure check.

Camilla Berglund 13 éve
szülő
commit
c87829ea61
1 módosított fájl, 5 hozzáadás és 0 törlés
  1. 5 0
      src/win32_monitor.c

+ 5 - 0
src/win32_monitor.c

@@ -124,6 +124,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
                     size = 4;
 
                 monitors = (_GLFWmonitor**) realloc(monitors, sizeof(_GLFWmonitor*) * size);
+                if (!monitors)
+                {
+                    // TODO: wat
+                    return NULL;
+                }
             }
 
             monitors[found] = _glfwCreateMonitor(name,