move some code to avoid deref of NULL ptr
authorBrian <brian.paul@tungstengraphics.com>
Wed, 12 Dec 2007 21:45:22 +0000 (14:45 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 12 Dec 2007 21:45:22 +0000 (14:45 -0700)
src/mesa/pipe/softpipe/sp_tile_cache.c

index 25c6dd4d1739d608be09cc48446618a2f1038913..d637c7291f61dacbc7ca68f7b1586c00269f46d1 100644 (file)
@@ -147,10 +147,10 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
 
    pipe_surface_reference(&tc->surface, ps);
 
-   if (!ps->map)
-      pipe_surface_map(ps);
-
    if (ps) {
+      if (!ps->map)
+         pipe_surface_map(ps);
+
       tc->depth_stencil = (ps->format == PIPE_FORMAT_S8Z24_UNORM ||
                            ps->format == PIPE_FORMAT_Z16_UNORM ||
                            ps->format == PIPE_FORMAT_Z32_UNORM ||