1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Added OOM error reporting to X11 mode enumeration.

This commit is contained in:
Camilla Berglund 2012-12-29 20:01:33 +01:00
parent 18854d16db
commit 20af66f271

View File

@ -354,6 +354,11 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
_glfwLibrary.X11.root); _glfwLibrary.X11.root);
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode) * count); result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode) * count);
if (!result)
{
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
return NULL;
}
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
@ -401,7 +406,13 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
if (result == NULL) if (result == NULL)
{ {
*found = 1; *found = 1;
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode)); result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode));
if (!result)
{
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
return NULL;
}
result[0].width = DisplayWidth(_glfwLibrary.X11.display, result[0].width = DisplayWidth(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen); _glfwLibrary.X11.screen);