st/mesa: move dereference after null check

We should not dereference shader before we have done the
null check.

Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Thomas Hindoe Paaboel Andersen
2016-03-01 14:45:00 -07:00
committed by Brian Paul
parent ad17511302
commit 37cfc51b13

View File

@@ -48,11 +48,13 @@ st_bind_images(struct st_context *st, struct gl_shader *shader,
{
unsigned i;
struct pipe_image_view images[MAX_IMAGE_UNIFORMS];
struct gl_program_constants *c = &st->ctx->Const.Program[shader->Stage];
struct gl_program_constants *c;
if (!shader || !st->pipe->set_shader_images)
return;
c = &st->ctx->Const.Program[shader->Stage];
for (i = 0; i < shader->NumImages; i++) {
struct gl_image_unit *u = &st->ctx->ImageUnits[shader->ImageUnits[i]];
struct st_texture_object *stObj = st_texture_object(u->TexObj);