intel: Don't segfault on glGenerateMipmaps of a cube map with one face defined.
authorEric Anholt <eric@anholt.net>
Wed, 20 May 2009 21:00:32 +0000 (14:00 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 21 May 2009 17:40:11 +0000 (10:40 -0700)
This presumably applies to SGIS_generate_mipmaps as well.

src/mesa/drivers/dri/intel/intel_tex_validate.c

index 05a375e1f3b375c4e28f6af64777bb595dbd81de..b5cb7597d164c684f4a298c71f9158265df27734 100644 (file)
@@ -241,7 +241,7 @@ intel_tex_map_level_images(struct intel_context *intel,
       struct intel_texture_image *intelImage =
         intel_texture_image(intelObj->base.Image[face][level]);
 
-      if (intelImage->mt) {
+      if (intelImage && intelImage->mt) {
         intelImage->base.Data =
            intel_miptree_image_map(intel,
                                    intelImage->mt,
@@ -268,7 +268,7 @@ intel_tex_unmap_level_images(struct intel_context *intel,
       struct intel_texture_image *intelImage =
         intel_texture_image(intelObj->base.Image[face][level]);
 
-      if (intelImage->mt) {
+      if (intelImage && intelImage->mt) {
         intel_miptree_image_unmap(intel, intelImage->mt);
         intelImage->base.Data = NULL;
       }