From: Dave Airlie Date: Sun, 29 May 2016 22:02:00 +0000 (+1000) Subject: egl/dri3: don't crash on no context. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d98d6e6269167230d20efdc45d608435a52f25fb;p=mesa.git egl/dri3: don't crash on no context. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94925 Pointed out by Karol Herbst on irc. Signed-off-by: Dave Airlie Cc: "11.1 11.2" Reviewed-by: Marek Olšák --- diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index 8e4a131b11a..9363a8a166f 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -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; }