diff options
author | Alan Third <alan@idiocy.org> | 2021-07-24 12:44:19 +0100 |
---|---|---|
committer | Alan Third <alan@idiocy.org> | 2021-07-26 21:04:05 +0100 |
commit | 246803f26fdec5f425418210167da0f93d4b3401 (patch) | |
tree | 856ea31e44eee573002fcd9bfaf528cbf9dc2812 /src | |
parent | 4f43058e9a69552e4bf600fd7a93bc1c459742ef (diff) | |
download | emacs-246803f26fdec5f425418210167da0f93d4b3401.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/nsimage.m | 8 |
1 files 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]; |