Merge pull request #2691 from zhongwuzw/fix_apng_property_crash

Fixes crash for apng coder when properties are nil
This commit is contained in:
DreamPiggy 2019-04-10 17:45:18 +08:00 committed by GitHub
commit 3540961abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -153,6 +153,9 @@ const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef
- (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source {
float frameDuration = 0.1f;
CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil);
if (!cfFrameProperties) {
return frameDuration;
}
NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties;
NSDictionary *pngProperties = frameProperties[(NSString *)kCGImagePropertyPNGDictionary];