diff --git a/renderdoc/driver/gl/gl_hooks_linux.cpp b/renderdoc/driver/gl/gl_hooks_linux.cpp index 70efbbb6c..d788fd5de 100644 --- a/renderdoc/driver/gl/gl_hooks_linux.cpp +++ b/renderdoc/driver/gl/gl_hooks_linux.cpp @@ -586,6 +586,10 @@ __attribute__ ((visibility ("default"))) GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct) { GLXContext ret = OpenGLHook::glhooks.glXCreateContext_real(dpy, vis, shareList, direct); + + // don't continue if context creation failed + if(!ret) + return ret; GLInitParams init; @@ -688,6 +692,10 @@ GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, GLXConte GLXContext ret = OpenGLHook::glhooks.glXCreateContextAttribsARB_real(dpy, config, shareList, direct, attribs); + // don't continue if context creation failed + if(!ret) + return ret; + XVisualInfo *vis = OpenGLHook::glhooks.glXGetVisualFromFBConfig_real(dpy, config); GLInitParams init; diff --git a/renderdoc/driver/gl/gl_hooks_win32.cpp b/renderdoc/driver/gl/gl_hooks_win32.cpp index 6842822cd..850d83cd3 100644 --- a/renderdoc/driver/gl/gl_hooks_win32.cpp +++ b/renderdoc/driver/gl/gl_hooks_win32.cpp @@ -386,8 +386,8 @@ class OpenGLHook : LibraryHook { HGLRC ret = glhooks.wglCreateContext_hook()(dc); - // don't recurse - if(glhooks.m_CreatingContext) + // don't recurse and don't continue if creation failed + if(glhooks.m_CreatingContext || ret == NULL) return ret; glhooks.m_CreatingContext = true; @@ -422,8 +422,8 @@ class OpenGLHook : LibraryHook { HGLRC ret = glhooks.wglCreateLayerContext_hook()(dc, iLayerPlane); - // don't recurse - if(glhooks.m_CreatingContext) + // don't recurse and don't continue if creation failed + if(glhooks.m_CreatingContext || ret == NULL) return ret; glhooks.m_CreatingContext = true; @@ -515,6 +515,10 @@ class OpenGLHook : LibraryHook HGLRC ret = glhooks.wglCreateContextAttribsARB_realfunc(dc, hShareContext, attribs); + // don't continue if creation failed + if(ret == NULL) + return ret; + GLWindowingData data; data.DC = dc; data.wnd = WindowFromDC(dc);