CR: ensure image is safe before generating thumbnail

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 32bf9d52a1
commit 2465d6df00

@ -364,6 +364,11 @@ NS_ASSUME_NONNULL_BEGIN
UIImage *_Nullable result;
if (self.isImage || self.isAnimated) {
if (![NSData ows_isValidImageAtPath:self.filePath]) {
DDLogWarn(@"%@ skipping thumbnail generation for invalid image at path: %@", self.logTag, self.filePath);
return;
}
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((__bridge CFURLRef)self.mediaURL, NULL);
OWSAssert(imageSource != NULL) NSDictionary *imageOptions = @{
(NSString const *)kCGImageSourceCreateThumbnailFromImageIfAbsent : (NSNumber const *)kCFBooleanTrue,

Loading…
Cancel
Save