glx: Don't segfault if glXGetContextIDEXT is pased a NULL context
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 7 Dec 2011 19:37:01 +0000 (11:37 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 19 Dec 2011 22:55:30 +0000 (14:55 -0800)
Fixes the piglit test glx-get-context-id.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glx/glxcmds.c

index 6ef7b926835a3cf2ee505bda9edb99761f276d55..f2c1884b8a5ce953be72b737bfbf57c2b41eba55 100644 (file)
@@ -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