Browse Source

egl: Handle error when binding EGL API in context creation

(cherry picked from commit 6b060435e3dba660270154d977bd5dae20e7814b)
sunshineinabox 3 days ago
parent
commit
c9271b2f18
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/video/SDL_egl.c

+ 4 - 1
src/video/SDL_egl.c

@@ -1097,7 +1097,10 @@ SDL_GLContext SDL_EGL_CreateContext(SDL_VideoDevice *_this, EGLSurface egl_surfa
     } else {
     } else {
         _this->egl_data->apitype = EGL_OPENGL_API;
         _this->egl_data->apitype = EGL_OPENGL_API;
     }
     }
-    _this->egl_data->eglBindAPI(_this->egl_data->apitype);
+    if (!_this->egl_data->eglBindAPI(_this->egl_data->apitype)) {
+        SDL_SetError("Could not bind EGL API");
+        return NULL;
+    }
 
 
     egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
     egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
                                                     _this->egl_data->egl_config,
                                                     _this->egl_data->egl_config,