added null ptr checks
authorBrian <brian.paul@tungstengraphics.com>
Thu, 9 Aug 2007 21:55:15 +0000 (22:55 +0100)
committerBrian <brian.paul@tungstengraphics.com>
Thu, 9 Aug 2007 21:55:15 +0000 (22:55 +0100)
src/mesa/pipe/softpipe/sp_context.c

index ebc994670a4f0c050124bdd3ee643c516bf5b29f..0794d9a88802a88f8c11c71398761b4c31e80a9c 100644 (file)
@@ -84,12 +84,15 @@ static void map_surfaces(struct softpipe_context *sp)
    GLuint i;
 
    for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
-      struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]);      pipe->region_map(pipe, sps->surface.region);
+      struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]);
+      if (sps->surface.region)
+         pipe->region_map(pipe, sps->surface.region);
    }
 
    if (sp->framebuffer.zbuf) {
       struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.zbuf);
-      pipe->region_map(pipe, sps->surface.region);
+      if (sps->surface.region)
+         pipe->region_map(pipe, sps->surface.region);
    }
 
    /* textures */
@@ -111,12 +114,14 @@ static void unmap_surfaces(struct softpipe_context *sp)
 
    for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
       struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]);
-      pipe->region_unmap(pipe, sps->surface.region);
+      if (sps->surface.region)
+         pipe->region_unmap(pipe, sps->surface.region);
    }
 
    if (sp->framebuffer.zbuf) {
       struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.zbuf);
-      pipe->region_unmap(pipe, sps->surface.region);
+      if (sps->surface.region)
+         pipe->region_unmap(pipe, sps->surface.region);
    }
 
    /* textures */