From a93cb0bfabfb9f4219e89fc5ed51c109a36f8db2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Sep 2014 09:19:17 +0200 Subject: [PATCH] - added a NULL check for GL resource context in init code. --- src/win32/win32gliface.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 59ce1e65e..e0fe92648 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -799,17 +799,20 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample) return false; } - wglMakeCurrent(m_hDC, m_hRC); + if (m_hRC != NULL) + { + wglMakeCurrent(m_hDC, m_hRC); - // we can only use core profile contexts if GL_ARB_buffer_storage is supported or GL version is >= 4.4 - if (prof == WGL_CONTEXT_CORE_PROFILE_BIT_ARB && !checkCoreUsability()) - { - wglMakeCurrent(0, 0); - wglDeleteContext(m_hRC); - } - else - { - return true; + // we can only use core profile contexts if GL_ARB_buffer_storage is supported or GL version is >= 4.4 + if (prof == WGL_CONTEXT_CORE_PROFILE_BIT_ARB && !checkCoreUsability()) + { + wglMakeCurrent(0, 0); + wglDeleteContext(m_hRC); + } + else + { + return true; + } } } return false;