forked from shadowfacts/Tusker
Fix crash when opening compose screen before initial network requests completed
This commit is contained in:
parent
cf48e4e973
commit
b623e348c2
|
@ -74,6 +74,15 @@ class ComposeAttachmentsViewController: UITableViewController {
|
|||
tableView.dragInteractionEnabled = true
|
||||
tableView.dragDelegate = self
|
||||
tableView.dropDelegate = self
|
||||
|
||||
if mastodonController.instance == nil {
|
||||
mastodonController.getOwnInstance { [weak self] (_) in
|
||||
guard let self = self else { return }
|
||||
DispatchQueue.main.async {
|
||||
self.updateAddAttachmentsButtonEnabled()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
@ -97,7 +106,9 @@ class ComposeAttachmentsViewController: UITableViewController {
|
|||
}
|
||||
|
||||
private func isAddAttachmentsButtonEnabled() -> Bool {
|
||||
switch mastodonController.instance.instanceType {
|
||||
switch mastodonController.instance?.instanceType {
|
||||
case nil:
|
||||
return false
|
||||
case .pleroma:
|
||||
return true
|
||||
case .mastodon:
|
||||
|
|
Loading…
Reference in New Issue