diff --git a/reactos/dll/win32/opengl32/opengl32.c b/reactos/dll/win32/opengl32/opengl32.c index 9be68aaa5e4..c810d1138ec 100644 --- a/reactos/dll/win32/opengl32/opengl32.c +++ b/reactos/dll/win32/opengl32/opengl32.c @@ -91,6 +91,7 @@ OPENGL32_ThreadDetach() if (!HeapFree( GetProcessHeap(), 0, lpData )) DBGPRINT( "Warning: HeapFree() on GLTHREADDATA failed (%d)", GetLastError() ); + lpData = NULL; } dispatchTable = NtCurrentTeb()->glTable; diff --git a/reactos/dll/win32/opengl32/wgl.c b/reactos/dll/win32/opengl32/wgl.c index 4b28c163b6c..7c1241551e5 100644 --- a/reactos/dll/win32/opengl32/wgl.c +++ b/reactos/dll/win32/opengl32/wgl.c @@ -978,6 +978,9 @@ rosglMakeCurrent( HDC hdc, HGLRC hglrc ) DBGTRACE( "Called!" ); + if (OPENGL32_threaddata == NULL) + return FALSE; + /* flush current context */ if (OPENGL32_threaddata->glrc != NULL) {