From 1b811f7e7dad92b2992939f854201370a7d8084a Mon Sep 17 00:00:00 2001 From: Cristy Date: Tue, 18 Jul 2017 12:54:51 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/584 --- coders/tiff.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/coders/tiff.c b/coders/tiff.c index 68a15f6a2..e25558fe8 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -2674,17 +2674,20 @@ static MagickBooleanType WritePTIFImage(const ImageInfo *image_info, AppendImageToList(&images,pyramid_image); } } - images=GetFirstImageInList(images); - /* - Write pyramid-encoded TIFF image. - */ - write_info=CloneImageInfo(image_info); - write_info->adjoin=MagickTrue; - (void) CopyMagickString(write_info->magick,"TIFF",MagickPathExtent); - (void) CopyMagickString(images->magick,"TIFF",MagickPathExtent); - status=WriteTIFFImage(write_info,images,exception); - images=DestroyImageList(images); - write_info=DestroyImageInfo(write_info); + if (images != (Image *) NULL) + { + /* + Write pyramid-encoded TIFF image. + */ + images=GetFirstImageInList(images); + write_info=CloneImageInfo(image_info); + write_info->adjoin=MagickTrue; + (void) CopyMagickString(write_info->magick,"TIFF",MagickPathExtent); + (void) CopyMagickString(images->magick,"TIFF",MagickPathExtent); + status=WriteTIFFImage(write_info,images,exception); + images=DestroyImageList(images); + write_info=DestroyImageInfo(write_info); + } return(status); } #endif -- 2.40.0