if id==0 in glGetQueryObject, raise GL_INVALID_OPERATION
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 28 Nov 2003 20:30:36 +0000 (20:30 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 28 Nov 2003 20:30:36 +0000 (20:30 +0000)
src/mesa/main/occlude.c

index 73a29cc93921629429ffc5f269123ce1b2f9a46e..2a3f8a00b9d920216538cf340a4b8a8c3de0ffe7 100644 (file)
@@ -274,11 +274,13 @@ void GLAPIENTRY
 _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct occlusion_query *q;
+   struct occlusion_query *q = NULL;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   q = (struct occlusion_query *)
-      _mesa_HashLookup(ctx->Occlusion.QueryObjects, id);
+   if (id)
+      q = (struct occlusion_query *)
+         _mesa_HashLookup(ctx->Occlusion.QueryObjects, id);
+
    if (!q || q->Active) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectivARB");
       return;
@@ -303,11 +305,12 @@ void GLAPIENTRY
 _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct occlusion_query *q;
+   struct occlusion_query *q = NULL;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   q = (struct occlusion_query *)
-      _mesa_HashLookup(ctx->Occlusion.QueryObjects, id);
+   if (id)
+      q = (struct occlusion_query *)
+         _mesa_HashLookup(ctx->Occlusion.QueryObjects, id);
    if (!q || q->Active) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectuivARB");
       return;