glsl: check if return_deref in lower_subroutine_visitor::visit_leave isn't NULL
authorKai Wasserbäch <kai@dev.carbon-project.org>
Fri, 14 Aug 2015 12:49:43 +0000 (14:49 +0200)
committerDave Airlie <airlied@redhat.com>
Thu, 20 Aug 2015 23:23:52 +0000 (09:23 +1000)
Fixes a crash in Piglit's
spec@arb_shader_subroutine@linker@no-mutual-recursion.vert for me.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/glsl/lower_subroutine.cpp

index b29912ad1509777d7833019ab2a3ca5b4fd4e53f..c1aed61a36a956d5f6f176bee1e22d21f2297484 100644 (file)
@@ -98,7 +98,7 @@ lower_subroutine_visitor::visit_leave(ir_call *ir)
       else
          last_branch = if_tree(equal(subr_to_int(var), lc), new_call, last_branch);
 
-      if (s > 0)
+      if (return_deref && s > 0)
         return_deref = return_deref->clone(mem_ctx, NULL);
    }
    if (last_branch)