From 38b22f9b8e800fd654a73998c6e043b8390d61b0 Mon Sep 17 00:00:00 2001 From: zhibinw Date: Wed, 25 May 2022 22:59:16 +0800 Subject: [PATCH] oxr:check EGL_NO_CONTEXT and return error --- src/xrt/state_trackers/oxr/oxr_session_gfx_gles_android.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xrt/state_trackers/oxr/oxr_session_gfx_gles_android.c b/src/xrt/state_trackers/oxr/oxr_session_gfx_gles_android.c index 3963c09a5..fc229cce7 100644 --- a/src/xrt/state_trackers/oxr/oxr_session_gfx_gles_android.c +++ b/src/xrt/state_trackers/oxr/oxr_session_gfx_gles_android.c @@ -59,6 +59,12 @@ oxr_session_populate_gles_android(struct oxr_logger *log, return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, "Call to getProcAddress(eglQueryContext) failed"); } + if (next->context == EGL_NO_CONTEXT) { + dlclose(so); + return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, + "XrGraphicsBindingOpenGLESAndroidKHR has EGL_NO_CONTEXT"); + } + if (!eglQueryContext(next->display, next->context, EGL_CONTEXT_CLIENT_TYPE, &egl_client_type)) { dlclose(so); return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED,