From 3b039d5910df77722eab6e44c2a2e7fd8f81f0b2 Mon Sep 17 00:00:00 2001 From: sukeban Date: Mon, 25 Jan 2016 14:21:17 -0800 Subject: [PATCH] Protect against malformed image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t add nil to the array, just skip the frame. --- SDWebImage/UIImage+GIF.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SDWebImage/UIImage+GIF.m b/SDWebImage/UIImage+GIF.m index e1ded2aa..e6d8577d 100755 --- a/SDWebImage/UIImage+GIF.m +++ b/SDWebImage/UIImage+GIF.m @@ -32,6 +32,8 @@ for (size_t i = 0; i < count; i++) { CGImageRef image = CGImageSourceCreateImageAtIndex(source, i, NULL); + if (!image) + continue; duration += [self sd_frameDurationAtIndex:i source:source];