egl/dri3: don't crash on no context.
authorDave Airlie <airlied@gmail.com>
Sun, 29 May 2016 22:02:00 +0000 (08:02 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 30 May 2016 01:30:04 +0000 (11:30 +1000)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94925

Pointed out by Karol Herbst on irc.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/egl/drivers/dri2/platform_x11_dri3.c

index 8e4a131b11a0fef09a737dc2f4a9e820d0bf7cf2..9363a8a166fff07255fa4b3e7590d1c55ee15715 100644 (file)
@@ -96,8 +96,10 @@ static __DRIcontext *
 egl_dri3_get_dri_context(struct loader_dri3_drawable *draw)
 {
    _EGLContext *ctx = _eglGetCurrentContext();
-   struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
-
+   struct dri2_egl_context *dri2_ctx;
+   if (!ctx)
+      return NULL;
+   dri2_ctx = dri2_egl_context(ctx);
    return dri2_ctx->dri_context;
 }