From 246803f26fdec5f425418210167da0f93d4b3401 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sat, 24 Jul 2021 12:44:19 +0100 Subject: [PATCH] Fix image crash on macOS (bug#49688) * src/nsimage.m ([EmacsImage allocInitFromFile:]): Use isValid to check whether the image is valid instead of generating a tiff. --- src/nsimage.m | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/nsimage.m b/src/nsimage.m index 3c16cd371e6..3668a7ab107 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -265,16 +265,12 @@ ns_image_size_in_bytes (void *img) image = [[EmacsImage alloc] initByReferencingFile:filename]; image->bmRep = nil; -#ifdef NS_IMPL_COCOA - imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; -#else - imgRep = [image bestRepresentationForDevice: nil]; -#endif - if (imgRep == nil) + if (![image isValid]) { [image release]; return nil; } + imgRep = [[image representations] firstObject]; [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; [image setName:filename]; -- 2.39.2