Fixes crash for apng coder when properties are nil

This commit is contained in:
zhongwuzw 2019-04-10 16:00:24 +08:00
parent 767a6643f8
commit d1eea26cd6
1 changed files with 3 additions and 0 deletions

View File

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