mesa/st: Fix NULL access if no fragment shader is bound
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 28 Mar 2016 15:01:49 +0000 (17:01 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 28 Mar 2016 16:02:07 +0000 (18:02 +0200)
Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_atom_constbuf.c

index 4d9b344111b26713db4e8c750c93ccc8764ca97e..a980dbedac5264eac1f394866fa640379b294c95 100644 (file)
@@ -65,8 +65,8 @@ void st_upload_constants( struct st_context *st,
           shader_type == PIPE_SHADER_COMPUTE);
 
    /* update the ATI constants before rendering */
-   struct ati_fragment_shader *ati_fs = st->fp->ati_fs;
-   if (shader_type == PIPE_SHADER_FRAGMENT && ati_fs) {
+   if (shader_type == PIPE_SHADER_FRAGMENT && st->fp->ati_fs) {
+      struct ati_fragment_shader *ati_fs = st->fp->ati_fs;
       unsigned c;
 
       for (c = 0; c < MAX_NUM_FRAGMENT_CONSTANTS_ATI; c++) {