src/video/x11/SDL_x11opengl.c
changeset 6522 edacce9402fb
parent 6393 a773384edf20
child 6570 45855398762c
--- a/src/video/x11/SDL_x11opengl.c	Sun Sep 30 01:01:48 2012 -0700
+++ b/src/video/x11/SDL_x11opengl.c	Sun Sep 30 01:08:48 2012 -0700
@@ -610,6 +610,11 @@
     GLXContext glx_context = (GLXContext) context;
     int status;
 
+    if (!_this->gl_data) {
+        SDL_SetError("OpenGL not initialized");
+        return -1;
+    }
+
     status = 0;
     if (!_this->gl_data->glXMakeCurrent(display, drawable, glx_context)) {
         SDL_SetError("Unable to make GL context current");
@@ -714,6 +719,9 @@
     Display *display = ((SDL_VideoData *) _this->driverdata)->display;
     GLXContext glx_context = (GLXContext) context;
 
+    if (!_this->gl_data) {
+        return;
+    }
     _this->gl_data->glXDestroyContext(display, glx_context);
     XSync(display, False);
 }