llvmpipe: stop crashing when one of the so targets is null
authorZack Rusin <zackr@vmware.com>
Sat, 27 Apr 2013 04:52:49 +0000 (00:52 -0400)
committerZack Rusin <zackr@vmware.com>
Sat, 27 Apr 2013 05:19:12 +0000 (01:19 -0400)
Fixes a crash when one of the so targets is null.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/drivers/llvmpipe/lp_draw_arrays.c

index e8a5880deef6fd330ce7fde3cfdfabc5ecaaa3b9..fc947b110d07eb11487d284f874bb7a2779c5908 100644 (file)
@@ -89,8 +89,11 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    }
 
    for (i = 0; i < lp->num_so_targets; i++) {
-      void *buf = llvmpipe_resource(lp->so_targets[i]->target.buffer)->data;
-      lp->so_targets[i]->mapping = buf;
+      void *buf = 0;
+      if (lp->so_targets[i]) {
+         buf = llvmpipe_resource(lp->so_targets[i]->target.buffer)->data;
+         lp->so_targets[i]->mapping = buf;
+      }
    }
    draw_set_mapped_so_targets(draw, lp->num_so_targets,
                               lp->so_targets);