From: Alan Third Date: Sat, 24 Jul 2021 11:44:19 +0000 (+0100) Subject: Fix image crash on macOS (bug#49688) X-Git-Tag: emacs-28.0.90~1686 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=246803f26fdec5f425418210167da0f93d4b3401;p=emacs.git 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. --- 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];