From 5def10c3a0a008cba01283411e38a46ba95f37f9 Mon Sep 17 00:00:00 2001 From: Gustav Date: Sat, 27 Aug 2016 00:32:20 +0200 Subject: [PATCH] Fixed OpenGL error when calling Shutdown without calling NewFrame --- examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp b/examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp index 7011875a..c1944fca 100644 --- a/examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp +++ b/examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp @@ -279,15 +279,15 @@ void ImGui_ImplSdlGL3_InvalidateDeviceObjects() if (g_ElementsHandle) glDeleteBuffers(1, &g_ElementsHandle); g_VaoHandle = g_VboHandle = g_ElementsHandle = 0; - glDetachShader(g_ShaderHandle, g_VertHandle); - glDeleteShader(g_VertHandle); + if(g_ShaderHandle && g_VertHandle ) glDetachShader(g_ShaderHandle, g_VertHandle); + if(g_VertHandle ) glDeleteShader(g_VertHandle); g_VertHandle = 0; - glDetachShader(g_ShaderHandle, g_FragHandle); - glDeleteShader(g_FragHandle); + if(g_ShaderHandle && g_FragHandle ) glDetachShader(g_ShaderHandle, g_FragHandle); + if(g_FragHandle ) glDeleteShader(g_FragHandle); g_FragHandle = 0; - glDeleteProgram(g_ShaderHandle); + if(g_ShaderHandle ) glDeleteProgram(g_ShaderHandle); g_ShaderHandle = 0; if (g_FontTexture)