fix crash when quoted attachment's content type is null

This commit is contained in:
ryanzhao 2021-09-30 11:47:34 +10:00
parent cebda588e8
commit bd73f14915

View file

@ -167,7 +167,7 @@ final class QuoteView : UIView {
if !hasAttachments {
mainStackView.addArrangedSubview(lineView)
} else {
let isAudio = MIMETypeUtil.isAudio(attachments.first!.contentType!)
let isAudio = MIMETypeUtil.isAudio(attachments.first!.contentType ?? "")
let fallbackImageName = isAudio ? "attachment_audio" : "actionsheet_document_black"
let fallbackImage = UIImage(named: fallbackImageName)?.withTint(.white)?.resizedImage(to: CGSize(width: iconSize, height: iconSize))
let imageView = UIImageView(image: thumbnail ?? fallbackImage)