diff options
author | Roopesh Chander <roop@roopc.net> | 2018-11-01 15:54:37 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-11-01 15:54:37 +0530 |
commit | 5138cdf9ea2294be8b5768e0d3cccca83e382820 (patch) | |
tree | a55cb1bbdc1932c27e2abec5ea67b1cd7a35af65 | |
parent | VPN: TunnelsManager: Fix deletion code (diff) | |
download | wireguard-apple-5138cdf9ea2294be8b5768e0d3cccca83e382820.tar.xz wireguard-apple-5138cdf9ea2294be8b5768e0d3cccca83e382820.zip |
Tunnel detail: Fix deletion of tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift index 6b9e753..14d715a 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift @@ -204,14 +204,15 @@ extension TunnelDetailTableViewController { cell.buttonText = "Delete tunnel" cell.onTapped = { [weak self] in guard let s = self else { return } - s.tunnelsManager.remove(tunnel: s.tunnel) { (error) in - if (error != nil) { - print("Error removing tunnel: \(String(describing: error))") - return - } - s.showConfirmationAlert(message: "Delete this tunnel?", buttonTitle: "Delete", from: cell) { [weak s] in - s?.navigationController?.navigationController?.popToRootViewController(animated: true) + s.showConfirmationAlert(message: "Delete this tunnel?", buttonTitle: "Delete", from: cell) { [weak s] in + guard let tunnelsManager = s?.tunnelsManager, let tunnel = s?.tunnel else { return } + tunnelsManager.remove(tunnel: tunnel) { (error) in + if (error != nil) { + print("Error removing tunnel: \(String(describing: error))") + return + } } + s?.navigationController?.navigationController?.popToRootViewController(animated: true) } } return cell |