From: Eric Anholt Date: Tue, 21 Feb 2012 21:17:40 +0000 (-0800) Subject: i965/gen6: Fix near-NULL deref in setting up GS binding table for non-XFB. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ab79d2be2e1288d4044a8b4ef356991625a176f5;p=mesa.git i965/gen6: Fix near-NULL deref in setting up GS binding table for non-XFB. Reviewed-by: Kenneth Graunke Tested-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c index 191ed5bd30f..07316c869a9 100644 --- a/src/mesa/drivers/dri/i965/gen6_sol.c +++ b/src/mesa/drivers/dri/i965/gen6_sol.c @@ -87,13 +87,16 @@ brw_gs_upload_binding_table(struct brw_context *brw) /* BRW_NEW_VERTEX_PROGRAM */ const struct gl_shader_program *shaderprog = ctx->Shader.CurrentVertexProgram; - const struct gl_transform_feedback_info *linked_xfb_info = - &shaderprog->LinkedTransformFeedback; - /* Currently we only ever upload surfaces for SOL. */ - bool has_surfaces = linked_xfb_info->NumOutputs != 0; - + bool has_surfaces = false; uint32_t *bind; + if (shaderprog) { + const struct gl_transform_feedback_info *linked_xfb_info = + &shaderprog->LinkedTransformFeedback; + /* Currently we only ever upload surfaces for SOL. */ + has_surfaces = linked_xfb_info->NumOutputs != 0; + } + /* Skip making a binding table if we don't have anything to put in it. */ if (!has_surfaces) { if (brw->gs.bind_bo_offset != 0) {