Added reporting of extension string retrieval failure.

This commit is contained in:
Camilla Berglund 2013-11-07 15:17:25 +01:00
Родитель e4a87b8a1c
Коммит 97ae40496d
1 изменённых файлов: 15 добавлений и 7 удалений

Просмотреть файл

@ -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,12 +577,16 @@ 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)
{
_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,13 +600,17 @@ 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)
{
_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
// Check if extension is in the platform-specific string