Skip to content

Commit

Permalink
epoxy_internal_has_gl_extension, epoxy_egl_version: add some missing …
Browse files Browse the repository at this point in the history
…nullpointer checks from https://bugzilla.redhat.com/show_bug.cgi?id=1395366

Related commit: b3b8bd9
 Fix "epoxy_glx_version" to handle the case when GLX is not active on the display.
Patch is tweak from the original version posted by Tom Horsley
  • Loading branch information
LocutusOfBorg committed Apr 24, 2017
1 parent 5b6d990 commit ce24887
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/dispatch_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ epoxy_internal_has_gl_extension(const char *ext, bool invalid_op_mode)

for (i = 0; i < num_extensions; i++) {
const char *gl_ext = (const char *)glGetStringi(GL_EXTENSIONS, i);
if(! gl_ext) return false;
if (strcmp(ext, gl_ext) == 0)
return true;
}
Expand Down
14 changes: 9 additions & 5 deletions src/dispatch_egl.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ epoxy_egl_version(EGLDisplay dpy)
{
int major, minor;
const char *version_string;
int ret;
int ret=0, sscanf_ret;

version_string = eglQueryString(dpy, EGL_VERSION);
ret = sscanf(version_string, "%d.%d", &major, &minor);
assert(ret == 2);
return major * 10 + minor;
if ((version_string = eglQueryString(dpy, EGL_VERSION)))
{
sscanf_ret = sscanf(version_string, "%d.%d", &major, &minor);
assert(sscanf_ret == 2);
ret = major * 10 + minor;
}

return ret;
}

bool
Expand Down

0 comments on commit ce24887

Please sign in to comment.