Skip to content
This repository was archived by the owner on Oct 9, 2019. It is now read-only.

Commit 5180a5d

Browse files
authored
Merge pull request #1 from langyanduan/master
fix encoding static single PNG image
2 parents b01af57 + 1090f9e commit 5180a5d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SDWebImageAPNGCoder/Classes/SDWebImageAPNGCoder.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ - (nullable NSData *)encodedDataWithImage:(nullable UIImage *)image format:(SDIm
142142
CFStringRef imageUTType = [NSData sd_UTTypeFromSDImageFormat:SDImageFormatPNG];
143143
NSArray<SDWebImageFrame *> *frames = [SDWebImageCoderHelper framesFromAnimatedImage:image];
144144

145-
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count, NULL);
145+
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count == 0 ? 1 : frames.count, NULL);
146146
if (!imageDestination) {
147147
// Handle failure.
148148
return nil;

0 commit comments

Comments
 (0)