From 6b060435e3dba660270154d977bd5dae20e7814b Mon Sep 17 00:00:00 2001
From: sunshineinabox <[EMAIL REDACTED]>
Date: Tue, 17 Mar 2026 21:45:42 -0700
Subject: [PATCH] egl: Handle error when binding EGL API in context creation
---
src/video/SDL_egl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index 6a3a4d85c4ad9..73db8f6f07121 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -1115,7 +1115,10 @@ SDL_GLContext SDL_EGL_CreateContext(SDL_VideoDevice *_this, EGLSurface egl_surfa
} else {
_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,
_this->egl_data->egl_config,