artgillespie/OGImage — pull request #32 by sixten (2014-03-14 23:16:10+00:00)
Title: Fixes for a few processing failures

In general, OGImage has been working well for us (thanks!). But I've tracked down a couple of crash reports we've gotten, and this should patch those up:

- Some images (GIFs, in particular), yield values from `CGImageGetAlphaInfo()` that are not supported by iOS. When passed to `CGBitmapContextCreate()`, it would fail to create the context. Those values are now re-written to `kCGImageAlphaPremultipliedFirst`.
- There was no code to verify the result of `CGBitmapContextCreate()` was non-NULL. (In fact, it doesn't appear that `UIImageToVImageBuffer()` would ever return a non-success status.) That has been corrected.
- It appears that the rest of `-scaleImage:toSize:cornerRadius:method:delegate:` was completing successfully with the empty buffer, and notifying its delegate. That `OGScaledImage` (in this case) was then attempting to insert an empty image into the cache, crashing the app. There are asserts in the cache insert, but I have added a guard condition, so that production apps won't crash.