Commit 7d80d0997 for imagemagick.org

commit 7d80d099799c6ca50f08beca6902e4bf107ef59a
Author: Dirk Lemstra <dirk@lemstra.org>
Date:   Sun Apr 26 18:02:24 2026 +0200

    Only reset the image type when ValidatePixelCacheMorphology returns false.

diff --git a/MagickCore/cache.c b/MagickCore/cache.c
index 85cd3d57a..c3b9f2f5d 100644
--- a/MagickCore/cache.c
+++ b/MagickCore/cache.c
@@ -1822,10 +1822,9 @@ static Cache GetImagePixelCache(Image *image,const MagickBooleanType clone,
       /*
         Ensure the image matches the pixel cache morphology.
       */
-      if (image->type != UndefinedType)
-        image->type=UndefinedType;
       if (ValidatePixelCacheMorphology(image) == MagickFalse)
         {
+          image->type=UndefinedType;
           status=OpenPixelCache(image,IOMode,exception);
           cache_info=(CacheInfo *) image->cache;
           if (cache_info->file != -1)