diff options
author | Thomas Hindoe Paaboel Andersen <[email protected]> | 2016-03-01 14:45:00 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2016-03-02 08:55:20 -0700 |
commit | 37cfc51b13712fad8e97c12f59efa2b3fb9fdae2 (patch) | |
tree | d494b27cdc31b2a400a9b3acb9b7dae0b2852012 /src | |
parent | ad175113023ec0f67bf51275d0aac20d9e3ea0b9 (diff) |
st/mesa: move dereference after null check
We should not dereference shader before we have done the
null check.
Reviewed-by: Erik Faye-Lund <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_atom_image.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_atom_image.c b/src/mesa/state_tracker/st_atom_image.c index 4b48bc30b69..d0f0c42a3b3 100644 --- a/src/mesa/state_tracker/st_atom_image.c +++ b/src/mesa/state_tracker/st_atom_image.c @@ -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); |