Bug 612572 - Crash [@GLContext::ListHasExtension] when extensions is null - r=jseward a=joe
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 18 Nov 2010 09:17:19 -0500
changeset 57853 789f0f85f75a3fa55d36c5d69a5b3bbbf3596410
parent 57852 c391595f55618c3896e5c1611ef3bed022cceef7
child 57854 7e42ccaa7269cd8cf0ed30684bc4a718673710c4
push idunknown
push userunknown
push dateunknown
reviewersjseward, joe
bugs612572
milestone2.0b8pre
Bug 612572 - Crash [@GLContext::ListHasExtension] when extensions is null - r=jseward a=joe
gfx/thebes/GLContext.cpp
--- a/gfx/thebes/GLContext.cpp
+++ b/gfx/thebes/GLContext.cpp
@@ -456,16 +456,20 @@ GLContext::IsExtensionSupported(const ch
 {
     return ListHasExtension(fGetString(LOCAL_GL_EXTENSIONS), extension);
 }
 
 // Common code for checking for both GL extensions and GLX extensions.
 PRBool
 GLContext::ListHasExtension(const GLubyte *extensions, const char *extension)
 {
+    // fix bug 612572 - we were crashing as we were calling this function with extensions==null
+    if (extensions == nsnull || extension == nsnull)
+        return PR_FALSE;
+
     const GLubyte *start;
     GLubyte *where, *terminator;
 
     /* Extension names should not have spaces. */
     where = (GLubyte *) strchr(extension, ' ');
     if (where || *extension == '\0')
         return PR_FALSE;