1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-27 04:28:52 -05:00

Added reporting of extension string retrieval failure.

This commit is contained in:
Camilla Berglund 2013-11-07 15:17:25 +01:00
parent e4a87b8a1c
commit 97ae40496d

View File

@ -566,7 +566,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
return GL_FALSE; return GL_FALSE;
} }
if (extension == NULL || *extension == '\0') if (!extension || *extension == '\0')
{ {
_glfwInputError(GLFW_INVALID_VALUE, NULL); _glfwInputError(GLFW_INVALID_VALUE, NULL);
return GL_FALSE; return GL_FALSE;
@ -577,11 +577,15 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
// Check if extension is in the old style OpenGL extensions string // Check if extension is in the old style OpenGL extensions string
extensions = glGetString(GL_EXTENSIONS); extensions = glGetString(GL_EXTENSIONS);
if (extensions != NULL) if (!extensions)
{ {
if (_glfwStringInExtensionString(extension, extensions)) _glfwInputError(GLFW_PLATFORM_ERROR,
return GL_TRUE; "Failed to retrieve extension string");
return GL_FALSE;
} }
if (_glfwStringInExtensionString(extension, extensions))
return GL_TRUE;
} }
#if defined(_GLFW_USE_OPENGL) #if defined(_GLFW_USE_OPENGL)
else else
@ -596,11 +600,15 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i); const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
if (en != NULL) if (!en)
{ {
if (strcmp(en, extension) == 0) _glfwInputError(GLFW_PLATFORM_ERROR,
return GL_TRUE; "Failed to retrieve extension string %i", i);
return GL_FALSE;
} }
if (strcmp(en, extension) == 0)
return GL_TRUE;
} }
} }
#endif // _GLFW_USE_OPENGL #endif // _GLFW_USE_OPENGL