1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 10:48:51 -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;
}
if (extension == NULL || *extension == '\0')
if (!extension || *extension == '\0')
{
_glfwInputError(GLFW_INVALID_VALUE, NULL);
return GL_FALSE;
@ -577,11 +577,15 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
// Check if extension is in the old style OpenGL extensions string
extensions = glGetString(GL_EXTENSIONS);
if (extensions != NULL)
if (!extensions)
{
if (_glfwStringInExtensionString(extension, extensions))
return GL_TRUE;
_glfwInputError(GLFW_PLATFORM_ERROR,
"Failed to retrieve extension string");
return GL_FALSE;
}
if (_glfwStringInExtensionString(extension, extensions))
return GL_TRUE;
}
#if defined(_GLFW_USE_OPENGL)
else
@ -596,11 +600,15 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
for (i = 0; i < count; i++)
{
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
if (en != NULL)
if (!en)
{
if (strcmp(en, extension) == 0)
return GL_TRUE;
_glfwInputError(GLFW_PLATFORM_ERROR,
"Failed to retrieve extension string %i", i);
return GL_FALSE;
}
if (strcmp(en, extension) == 0)
return GL_TRUE;
}
}
#endif // _GLFW_USE_OPENGL