Prevent crash on add and deletion of config.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
b8abaa5283
commit
3a8f8ef9e6
|
@ -328,6 +328,7 @@ extension AppCoordinator: TunnelsTableViewControllerDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func connect(tunnel: Tunnel, tunnelsTableViewController: TunnelsTableViewController) {
|
func connect(tunnel: Tunnel, tunnelsTableViewController: TunnelsTableViewController) {
|
||||||
|
_ = refreshProviderManagers().then { () -> Promise<Void> in
|
||||||
let manager = self.providerManager(for: tunnel)!
|
let manager = self.providerManager(for: tunnel)!
|
||||||
let block = {
|
let block = {
|
||||||
switch manager.connection.status {
|
switch manager.connection.status {
|
||||||
|
@ -345,9 +346,13 @@ extension AppCoordinator: TunnelsTableViewControllerDelegate {
|
||||||
} else {
|
} else {
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Promise.value(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func disconnect(tunnel: Tunnel, tunnelsTableViewController: TunnelsTableViewController) {
|
func disconnect(tunnel: Tunnel, tunnelsTableViewController: TunnelsTableViewController) {
|
||||||
|
_ = refreshProviderManagers().then { () -> Promise<Void> in
|
||||||
let manager = self.providerManager(for: tunnel)!
|
let manager = self.providerManager(for: tunnel)!
|
||||||
let block = {
|
let block = {
|
||||||
switch manager.connection.status {
|
switch manager.connection.status {
|
||||||
|
@ -365,6 +370,8 @@ extension AppCoordinator: TunnelsTableViewControllerDelegate {
|
||||||
} else {
|
} else {
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
|
return Promise.value(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func connect(tunnel: Tunnel) {
|
private func connect(tunnel: Tunnel) {
|
||||||
|
|
Loading…
Reference in New Issue