diff --git a/Tusker/Views/ContentTextView.swift b/Tusker/Views/ContentTextView.swift index 75b93de9..c736f739 100644 --- a/Tusker/Views/ContentTextView.swift +++ b/Tusker/Views/ContentTextView.swift @@ -207,10 +207,12 @@ class ContentTextView: LinkTextView, BaseEmojiLabel { func getViewController(forLink url: URL, inRange range: NSRange) -> UIViewController? { let text = (self.text as NSString).substring(with: range) - if let mention = getMention(for: url, text: text) { - return ProfileViewController(accountID: mention.id, mastodonController: mastodonController!) - } else if let tag = getHashtag(for: url, text: text) { - return HashtagTimelineViewController(for: tag, mastodonController: mastodonController!) + if let mention = getMention(for: url, text: text), + let mastodonController { + return ProfileViewController(accountID: mention.id, mastodonController: mastodonController) + } else if let tag = getHashtag(for: url, text: text), + let mastodonController { + return HashtagTimelineViewController(for: tag, mastodonController: mastodonController) } else if url.scheme == "https" || url.scheme == "http" { let vc = SFSafariViewController(url: url) vc.preferredControlTintColor = Preferences.shared.accentColor.color