From d1eea26cd67d4b19f93fa319bd857c6ffb0c277e Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Wed, 10 Apr 2019 16:00:24 +0800 Subject: [PATCH] Fixes crash for apng coder when properties are nil --- SDWebImage/SDImageAPNGCoder.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SDWebImage/SDImageAPNGCoder.m b/SDWebImage/SDImageAPNGCoder.m index 64384122..52f2060d 100644 --- a/SDWebImage/SDImageAPNGCoder.m +++ b/SDWebImage/SDImageAPNGCoder.m @@ -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];