st/mesa: Move dereference and assignment to after NULL check.
authorVinson Lee <vlee@vmware.com>
Fri, 16 Apr 2010 06:15:05 +0000 (23:15 -0700)
committerVinson Lee <vlee@vmware.com>
Fri, 16 Apr 2010 06:15:05 +0000 (23:15 -0700)
src/mesa/state_tracker/st_cb_texture.c

index 196bf1325fbd49d261125de074f8c8240d6e0cbd..9479819e8334d6c67423a9c42b55820f67517b51 100644 (file)
@@ -1213,10 +1213,11 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
    int srcBlockStride;
    int dstBlockStride;
    int y;
-   enum pipe_format pformat= stImage->pt->format;
+   enum pipe_format pformat;
 
    if (stImage->pt) {
       unsigned face = _mesa_tex_target_to_face(target);
+      pformat = stImage->pt->format;
 
       st_teximage_flush_before_map(ctx->st, stImage->pt, face, level,
                                   PIPE_TRANSFER_WRITE);