Fix crash if ContentTextView asked for context menu config w/o mastodon controller
This commit is contained in:
parent
b40d815274
commit
de946be008
|
@ -207,10 +207,12 @@ class ContentTextView: LinkTextView, BaseEmojiLabel {
|
||||||
func getViewController(forLink url: URL, inRange range: NSRange) -> UIViewController? {
|
func getViewController(forLink url: URL, inRange range: NSRange) -> UIViewController? {
|
||||||
let text = (self.text as NSString).substring(with: range)
|
let text = (self.text as NSString).substring(with: range)
|
||||||
|
|
||||||
if let mention = getMention(for: url, text: text) {
|
if let mention = getMention(for: url, text: text),
|
||||||
return ProfileViewController(accountID: mention.id, mastodonController: mastodonController!)
|
let mastodonController {
|
||||||
} else if let tag = getHashtag(for: url, text: text) {
|
return ProfileViewController(accountID: mention.id, mastodonController: mastodonController)
|
||||||
return HashtagTimelineViewController(for: tag, 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" {
|
} else if url.scheme == "https" || url.scheme == "http" {
|
||||||
let vc = SFSafariViewController(url: url)
|
let vc = SFSafariViewController(url: url)
|
||||||
vc.preferredControlTintColor = Preferences.shared.accentColor.color
|
vc.preferredControlTintColor = Preferences.shared.accentColor.color
|
||||||
|
|
Loading…
Reference in New Issue