Fix “Invalid media attachments” crash.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-06-16 14:58:11 -04:00
parent c758f85cc8
commit 6276dcb34c
3 changed files with 3 additions and 6 deletions

View file

@ -103,8 +103,7 @@ NS_ASSUME_NONNULL_BEGIN
NSData *fileData = [NSData dataWithContentsOfURL:[self.attachment mediaURL]];
if (!fileData) {
DDLogError(@"%@ Could not load image: %@", [self tag], [self.attachment mediaURL]);
OWSAssert(0);
return nil;
return [UIView new];
}
FLAnimatedImage *animatedGif = [FLAnimatedImage animatedImageWithGIFData:fileData];
FLAnimatedImageView *imageView = [[FLAnimatedImageView alloc] init];

View file

@ -75,8 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
UIImage *image = self.attachment.image;
if (!image) {
DDLogError(@"%@ Could not load image: %@", [self tag], [self.attachment mediaURL]);
OWSAssert(0);
return nil;
return [UIView new];
}
CGSize size = [self mediaViewDisplaySize];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

View file

@ -227,8 +227,7 @@ NS_ASSUME_NONNULL_BEGIN
UIImage *image = self.attachment.image;
if (!image) {
DDLogError(@"%@ Could not load image: %@", [self tag], [self.attachment mediaURL]);
OWSAssert(0);
return nil;
return [UIView new];
}
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.contentMode = UIViewContentModeScaleAspectFill;