浏览代码

Added allocation failure check.

Camilla Berglund 13 年之前
父节点
当前提交
c87829ea61
共有 1 个文件被更改,包括 5 次插入0 次删除
  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,