Skip to content

Commit

Permalink
[lipstick] Fix crash on non-hybris devices. Fixes MER#2031
Browse files Browse the repository at this point in the history
eglQueryString can return NULL (see
https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglQueryString.xhtml)
and on systems like the Xiaomi MiPad 2 (Latte) which uses mesa/i915 this is the
case.
  • Loading branch information
piggz committed Mar 28, 2019
1 parent da781e1 commit 281ca0f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/compositor/eglhybrisfunctions.cpp
Expand Up @@ -17,9 +17,17 @@

#include <QGlobalStatic>

static const char* checked_strstr(const char *haystack, const char *needle)
{
if (!haystack || !needle) {
return 0;
}
return strstr(haystack, needle);
}

struct SupportedEglHybrisFunctions : public EglHybrisFunctions
{
const bool supported = strstr(eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS), "EGL_HYBRIS_native_buffer2") != 0
const bool supported = checked_strstr(eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS), "EGL_HYBRIS_native_buffer2") != 0
&& glEGLImageTargetTexture2DOES
&& eglCreateImageKHR
&& eglDestroyImageKHR
Expand Down

0 comments on commit 281ca0f

Please sign in to comment.