diff --git a/Tusker/Caching/ImageCache.swift b/Tusker/Caching/ImageCache.swift index f560acb3..b3a222d9 100644 --- a/Tusker/Caching/ImageCache.swift +++ b/Tusker/Caching/ImageCache.swift @@ -37,15 +37,19 @@ class ImageCache { let wrappedCompletion: ((Data?, UIImage?) -> Void)? if let completion = completion { wrappedCompletion = { (data, image) in - if !loadOriginal, - let size = self.desiredPixelSize { - image?.prepareThumbnail(of: size, completionHandler: { - completion(data, $0) - }) - } else { - image?.prepareForDisplay { - completion(data, $0) + if let image { + if !loadOriginal, + let size = self.desiredPixelSize { + image.prepareThumbnail(of: size) { + completion(data, $0) + } + } else { + image.prepareForDisplay { + completion(data, $0) + } } + } else { + completion(data, image) } } } else {