softpipe: Prevent NULL ptr derreference on takedown.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Fri, 4 Jul 2008 18:21:27 +0000 (03:21 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Fri, 4 Jul 2008 18:51:26 +0000 (03:51 +0900)
src/gallium/drivers/softpipe/sp_state_fs.c

index 24b91fbc79435aa7c390b7e65c7cde30ceb22f64..901c8f83e75ae87ca02463f722c74c0a530cc6e5 100644 (file)
@@ -154,8 +154,8 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
    /* note: reference counting */
    pipe_buffer_reference(ws,
                         &softpipe->constants[shader].buffer,
-                        buf->buffer);
-   softpipe->constants[shader].size = buf->size;
+                        buf ? buf->buffer : NULL);
+   softpipe->constants[shader].size = buf ? buf->size : 0;
 
    softpipe->dirty |= SP_NEW_CONSTANTS;
 }