Fixing sd_imageOrientationFromImageData call crashes if image is nil, re... #813
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have seen that SDWebImage has added support for image orientation that our apps are crashing now on line 63 of UIImage+MultiFormat.m.
I do not know why, but on some circumstances it might be that imageData is nil. If that is the case, imageSource would be imageSource pointing to 0x00000000, and CFRelease'ing it throws an exception that crashes the whole app.
My suggested fix, is to check for nil on imageSource in sd_imageOrientationFromImageData, and return UIImageOrientationUp if there is no image (UIImage+Multiformat.h)