Fixes a crash when one of the so targets is null.

Signed-off-by: Zack Rusin <za...@vmware.com>
---
 src/gallium/drivers/llvmpipe/lp_draw_arrays.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c 
b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c
index e8a5880..fc947b1 100644
--- a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c
+++ b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c
@@ -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);
-- 
1.7.10.4
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to