egl: Don't crash if we failed halfway through SDL_CreateWindow.

This commit is contained in:
Ryan C. Gordon 2021-05-11 14:08:17 -04:00
parent f2f451a59d
commit e1db4b82ec
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 11 additions and 2 deletions

View File

@ -1090,6 +1090,15 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
return SDL_SetError("OpenGL not initialized");
}
if (!_this->egl_data->eglMakeCurrent) {
if (!egl_surface && !context) {
/* Can't do the nothing there is to do? Probably trying to cleanup a failed startup, just return. */
return 0;
} else {
return SDL_SetError("OpenGL not initialized"); /* something clearly went wrong somewhere. */
}
}
/* The android emulator crashes badly if you try to eglMakeCurrent
* with a valid context and invalid surface, so we have to check for both here.
*/