diff --git a/util/EGLWindow.cpp b/util/EGLWindow.cpp index 7e31463a0..21383a5d5 100644 --- a/util/EGLWindow.cpp +++ b/util/EGLWindow.cpp @@ -178,8 +178,14 @@ bool EGLWindow::initializeDisplay(OSWindow *osWindow, LoadUtilEGL(getProcAddress); #endif // defined(ANGLE_USE_UTIL_LOADER) + // EGL_NO_DISPLAY + EGL_EXTENSIONS returns NULL before Android 10 const char *extensionString = static_cast(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS)); + if (!extensionString) + { + // fallback to an empty string for strstr + extensionString = ""; + } std::vector displayAttributes; displayAttributes.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); @@ -879,10 +885,11 @@ void EGLWindow::Delete(EGLWindow **window) void EGLWindow::queryFeatures() { + // EGL_NO_DISPLAY + EGL_EXTENSIONS returns NULL before Android 10 const char *extensionString = static_cast(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS)); const bool hasFeatureControlANGLE = - strstr(extensionString, "EGL_ANGLE_feature_control") != nullptr; + extensionString && strstr(extensionString, "EGL_ANGLE_feature_control") != nullptr; if (!hasFeatureControlANGLE) {