draw/gs: Return early if the passed geometry shader is null
authorZack Rusin <zackr@vmware.com>
Wed, 17 Apr 2013 03:17:08 +0000 (20:17 -0700)
committerZack Rusin <zackr@vmware.com>
Wed, 17 Apr 2013 06:38:47 +0000 (23:38 -0700)
Can happen if we were using stream output without geometry
shader, by returning early we avoid a crash.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/draw/draw_gs.c

index f8cb04a8f39e70637e7976b0240b9095f1bf8620..987c01a79192c355aade6cfbac77af0788de83ab 100644 (file)
@@ -788,6 +788,9 @@ void draw_bind_geometry_shader(struct draw_context *draw,
 void draw_delete_geometry_shader(struct draw_context *draw,
                                  struct draw_geometry_shader *dgs)
 {
+   if (!dgs) {
+      return;
+   }
 #ifdef HAVE_LLVM
    if (draw_get_option_use_llvm()) {
       struct llvm_geometry_shader *shader = llvm_geometry_shader(dgs);