Skip to content

Commit

Permalink
Merge pull request #14 from nmarisi/master
Browse files Browse the repository at this point in the history
Fixed crash caused by decodedImage in CCBufferedImageView being nil.
  • Loading branch information
neonichu committed Jan 25, 2016
2 parents f8294e0 + 46e6d92 commit a70b53c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Code/CCBufferedImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ public class CCBufferedImageView : UIImageView, NSURLConnectionDataDelegate {
dispatch_sync(queue) {
let decoder = CCBufferedImageDecoder(data: self.data)
decoder.decompress()
let decodedImage = decoder.toImage()


guard let decodedImage = decoder.toImage() else {
return
}

UIGraphicsBeginImageContext(CGSizeMake(1,1))
let context = UIGraphicsGetCurrentContext()
CGContextDrawImage(context, CGRectMake(0, 0, 1, 1), decodedImage.CGImage)
Expand Down

0 comments on commit a70b53c

Please sign in to comment.