Merge pull request #279 from RyanRory/sending-gif-crash

Fix Crash on Sending Certain GIFs
This commit is contained in:
Niels Andriesse 2020-09-23 16:31:45 +10:00 committed by GitHub
commit 13630aac6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -4098,6 +4098,14 @@ typedef enum : NSUInteger {
didApproveAttachments:(NSArray<SignalAttachment *> *)attachments
messageText:(NSString *_Nullable)messageText
{
for (SignalAttachment *attachment in attachments) {
if ([attachment hasError]) {
OWSLogWarn(@"Invalid attachment: %@.", attachment ? [attachment errorName] : @"Missing data");
[self showErrorAlertForAttachment:attachment];
return;
}
}
[self tryToSendAttachments:attachments messageText:messageText];
[self.inputToolbar clearTextMessageAnimated:NO];
[self resetMentions];

View File

@ -50,7 +50,9 @@ public class AttachmentPrepViewController: OWSViewController, PlayerProgressBarD
init(attachmentItem: SignalAttachmentItem) {
self.attachmentItem = attachmentItem
super.init(nibName: nil, bundle: nil)
assert(!attachment.hasError)
if attachment.hasError {
owsFailDebug(attachment.error.debugDescription)
}
}
public required init?(coder aDecoder: NSCoder) {

View File

@ -63,7 +63,9 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
// of nice that it's written in a flexible way in case we'd want to use it elsewhere again in the future.
@objc
public required init(attachment: SignalAttachment, mode: MediaMessageViewMode) {
assert(!attachment.hasError)
if attachment.hasError {
owsFailDebug(attachment.error.debugDescription)
}
self.attachment = attachment
self.mode = mode
super.init(frame: CGRect.zero)
@ -336,7 +338,7 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
case .small, .large:
return Colors.accent
case .attachmentApproval:
return UIColor.white
return Colors.text
}
}