forked from shadowfacts/Tusker
Fix crash when creating menu actions for status w/o URL
This commit is contained in:
parent
160f48679b
commit
cfc69627e5
|
@ -176,13 +176,18 @@ extension MenuActionProvider {
|
|||
guard let accountID = mastodonController.accountInfo?.id,
|
||||
let account = mastodonController.account else {
|
||||
// user is logged out
|
||||
return [
|
||||
openInSafariAction(url: status.url!),
|
||||
createAction(identifier: "share", title: "Share", systemImageName: "square.and.arrow.up", handler: { [weak self] (_) in
|
||||
guard let self = self else { return }
|
||||
self.navigationDelegate?.showMoreOptions(forStatus: status.id, source: source)
|
||||
})
|
||||
]
|
||||
// i don't know why exactly a status wouldn't have a url, but apparently it happens, so:
|
||||
if let url = status.url {
|
||||
return [
|
||||
openInSafariAction(url: url),
|
||||
createAction(identifier: "share", title: "Share", systemImageName: "square.and.arrow.up", handler: { [weak self] (_) in
|
||||
guard let self = self else { return }
|
||||
self.navigationDelegate?.showMoreOptions(forStatus: status.id, source: source)
|
||||
}),
|
||||
]
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
let bookmarked = status.bookmarked ?? false
|
||||
|
||||
|
|
Loading…
Reference in New Issue