Skip to content

Commit

Permalink
Fixed crash if the OpenGL library hasn't been loaded yet
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 1, 1970
1 parent d12d795 commit e14e0ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/video/x11/SDL_x11opengl.c
Expand Up @@ -511,17 +511,16 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
XVisualInfo *
X11_GL_GetVisual(_THIS, Display * display, int screen)
{
XVisualInfo *vinfo;

/* 64 seems nice. */
int attribs[64];
X11_GL_GetAttributes(_this,display,screen,attribs,64,SDL_FALSE);
XVisualInfo *vinfo;

if (!_this->gl_data) {
/* The OpenGL library wasn't loaded, SDL_GetError() should have info */
return NULL;
}

X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE);
vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
if (!vinfo) {
SDL_SetError("Couldn't find matching GLX visual");
Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11window.c
Expand Up @@ -373,7 +373,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
#if SDL_VIDEO_OPENGL_GLX
&& ( !_this->gl_data || ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile )
#endif
){
) {
vinfo = X11_GLES_GetVisual(_this, display, screen);
} else
#endif
Expand Down

0 comments on commit e14e0ef

Please sign in to comment.