From 97ae40496d473e90dfa02041e3f67287a67b095c Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 7 Nov 2013 15:17:25 +0100 Subject: [PATCH] Added reporting of extension string retrieval failure. --- src/context.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/context.c b/src/context.c index ca7b8d61..cdc9d911 100644 --- a/src/context.c +++ b/src/context.c @@ -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