aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-01 15:54:37 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-01 15:54:37 +0530
commit5138cdf9ea2294be8b5768e0d3cccca83e382820 (patch)
treea55cb1bbdc1932c27e2abec5ea67b1cd7a35af65
parentVPN: TunnelsManager: Fix deletion code (diff)
downloadwireguard-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.swift15
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