From: Emil Velikov Date: Tue, 10 Oct 2017 17:50:13 +0000 (+0100) Subject: egl/dri: don't crash when createImageFromRenderbuffer2 is NULL X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=872a373bc829b7eb6d94063023934b3713185d75;p=mesa.git egl/dri: don't crash when createImageFromRenderbuffer2 is NULL The __DRI_IMAGE version can be 17 or over, while the function pointer is NULL. Guard for that instead of crashing. Fixes: bad24395d91 ("egl/dri: use createImageFromRenderbuffer2 when available") Signed-off-by: Emil Velikov Reviewed-by: Eric Anholt Reviewed-by: Nicolai Hähnle --- diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 5334384d2f5..d5cdf32afa6 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1890,7 +1890,8 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx, return EGL_NO_IMAGE_KHR; } - if (dri2_dpy->image->base.version >= 17) { + if (dri2_dpy->image->base.version >= 17 && + dri2_dpy->image->createImageFromRenderbuffer2) { unsigned error = ~0; dri_image = dri2_dpy->image->createImageFromRenderbuffer2(