From: Ian Romanick Date: Wed, 7 Dec 2011 19:37:01 +0000 (-0800) Subject: glx: Don't segfault if glXGetContextIDEXT is pased a NULL context X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3b9b42250ca9f0da6e979afc047d1c8524466076;p=mesa.git glx: Don't segfault if glXGetContextIDEXT is pased a NULL context Fixes the piglit test glx-get-context-id. NOTE: This is a candidate for the 7.11 branch. Signed-off-by: Ian Romanick Reviewed-by: Adam Jackson Reviewed-by: Eric Anholt --- diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 6ef7b926835..f2c1884b8a5 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -1563,7 +1563,7 @@ _X_EXPORT GLXContextID glXGetContextIDEXT(const GLXContext ctx_user) { struct glx_context *ctx = (struct glx_context *) ctx_user; - return ctx->xid; + return (ctx == NULL) ? None : ctx->xid; } _X_EXPORT