aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift9
1 files changed, 5 insertions, 4 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
index 539b487..5ae89c4 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelsListTableViewController.swift
@@ -155,10 +155,6 @@ class TunnelsListTableViewController: NSViewController {
ErrorPresenter.showErrorAlert(error: error, from: self)
return
}
- let tunnelIndex = min(selectedTunnelIndex, self.tunnelsManager.numberOfTunnels() - 1)
- if tunnelIndex >= 0 {
- self.selectTunnel(at: tunnelIndex)
- }
}
}
}
@@ -249,10 +245,15 @@ extension TunnelsListTableViewController {
}
func tunnelRemoved(at index: Int) {
+ let selectedTunnelIndex = tableView.selectedRow
tableView.removeRows(at: IndexSet(integer: index), withAnimation: .slideLeft)
if tunnelsManager.numberOfTunnels() == 0 {
delegate?.tunnelsListEmpty()
}
+ let tunnelIndex = min(selectedTunnelIndex, self.tunnelsManager.numberOfTunnels() - 1)
+ if tunnelIndex >= 0 {
+ self.selectTunnel(at: tunnelIndex)
+ }
}
}