Prevent crash on add and deletion of config.

This commit is contained in:
Jeroen Leenarts 2018-09-15 21:23:47 +02:00
parent 5df512d4fe
commit 39990ab480
1 changed files with 31 additions and 24 deletions

View File

@ -328,6 +328,7 @@ extension AppCoordinator: TunnelsTableViewControllerDelegate {
}
func connect(tunnel: Tunnel, tunnelsTableViewController: TunnelsTableViewController) {
_ = refreshProviderManagers().then { () -> Promise<Void> in
let manager = self.providerManager(for: tunnel)!
let block = {
switch manager.connection.status {
@ -345,9 +346,13 @@ extension AppCoordinator: TunnelsTableViewControllerDelegate {
} else {
block()
}
return Promise.value(())
}
}
func disconnect(tunnel: Tunnel, tunnelsTableViewController: TunnelsTableViewController) {
_ = refreshProviderManagers().then { () -> Promise<Void> in
let manager = self.providerManager(for: tunnel)!
let block = {
switch manager.connection.status {
@ -365,6 +370,8 @@ extension AppCoordinator: TunnelsTableViewControllerDelegate {
} else {
block()
}
return Promise.value(())
}
}
private func connect(tunnel: Tunnel) {