From 85812d774d70626bca882c4e1620021f43ab24e9 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 17 Nov 2019 14:45:38 -0500 Subject: [PATCH] Fix crash when trying to open context menu for attachment that hasn't yet loaded --- Tusker/Views/Status/StatusTableViewCell.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tusker/Views/Status/StatusTableViewCell.swift b/Tusker/Views/Status/StatusTableViewCell.swift index 260bdb44..fcec8fe1 100644 --- a/Tusker/Views/Status/StatusTableViewCell.swift +++ b/Tusker/Views/Status/StatusTableViewCell.swift @@ -445,8 +445,8 @@ extension StatusTableViewCell: MenuPreviewProvider { return (content: { ProfileTableViewController(accountID: self.accountID) }, actions: { self.actionsForProfile(accountID: self.accountID) }) } else if attachmentsView.frame.contains(location) { let attachmentsViewLocation = attachmentsView.convert(location, from: self) - if let attachmentView = attachmentsView.subviews.first(where: { $0.frame.contains(attachmentsViewLocation) }) as? AttachmentView { - let image = attachmentView.image! + if let attachmentView = attachmentsView.subviews.first(where: { $0.frame.contains(attachmentsViewLocation) }) as? AttachmentView, + let image = attachmentView.image { let description = attachmentView.attachment.description return (content: { self.delegate?.largeImage(image, description: description, sourceView: attachmentView) }, actions: { [] }) }