Source/WebCore/ChangeLog

 12011-05-27 Simon Fraser <simon.fraser@apple.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 CG BitmapImage needs to check for valid CGImage in a couple of places
 6 https://bugs.webkit.org/show_bug.cgi?id=61684
 7 <rdar://problem/9519348>
 8
 9 BitmapImage::getCGImageArray() can throw an exception if frameAtIndex()
 10 returns null, which it may do if the image is corrupted or still
 11 loading. Protect against that here and in getFirstCGImageRefOfSize().
 12
 13 * platform/graphics/cg/ImageCG.cpp:
 14 (WebCore::BitmapImage::getFirstCGImageRefOfSize):
 15 (WebCore::BitmapImage::getCGImageArray):
 16
1172011-05-27 Stephanie Lewis <slewis@apple.com>
218
319 Unreviewed.

Source/WebCore/platform/graphics/cg/ImageCG.cpp

@@CGImageRef BitmapImage::getFirstCGImageRefOfSize(const IntSize& size)
160160 size_t count = frameCount();
161161 for (size_t i = 0; i < count; ++i) {
162162 CGImageRef cgImage = frameAtIndex(i);
163  if (IntSize(CGImageGetWidth(cgImage), CGImageGetHeight(cgImage)) == size)
 163 if (cgImage && IntSize(CGImageGetWidth(cgImage), CGImageGetHeight(cgImage)) == size)
164164 return cgImage;
165165 }
166166

@@RetainPtr<CFArrayRef> BitmapImage::getCGImageArray()
175175 return 0;
176176
177177 CFMutableArrayRef array = CFArrayCreateMutable(NULL, count, &kCFTypeArrayCallBacks);
178  for (size_t i = 0; i < count; ++i)
179  CFArrayAppendValue(array, frameAtIndex(i));
180 
 178 for (size_t i = 0; i < count; ++i) {
 179 if (CGImageRef currFrame = frameAtIndex(i))
 180 CFArrayAppendValue(array, currFrame);
 181 }
181182 return RetainPtr<CFArrayRef>(AdoptCF, array);
182183}
183184