llvmpipe: guard against NULL task->query pointer
authorKeith Whitwell <keithw@vmware.com>
Tue, 2 Nov 2010 12:05:46 +0000 (12:05 +0000)
committerKeith Whitwell <keithw@vmware.com>
Tue, 2 Nov 2010 16:48:10 +0000 (16:48 +0000)
This doesn't seem like it should be possible, but some test suites
manage to hit this case.  Avoid crashing release builds under those
circumstances.

src/gallium/drivers/llvmpipe/lp_rast.c

index d358a983943080170e3d34bbe76b142375aa4cdd..decf3bd44991bc46dd3ed45d7c3a4af40e5ec1c2 100644 (file)
@@ -485,8 +485,11 @@ static void
 lp_rast_end_query(struct lp_rasterizer_task *task,
                   const union lp_rast_cmd_arg arg)
 {
-   task->query->count[task->thread_index] += task->vis_counter;
-   task->query = NULL;
+   assert(task->query);
+   if (task->query) {
+      task->query->count[task->thread_index] += task->vis_counter;
+      task->query = NULL;
+   }
 }