aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-24 12:58:35 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-24 13:01:21 +0530
commit808852c547bd4d3d5d368db74d61980a5a5c2f6c (patch)
tree8a7633be90ca490a96d3052e4d87ebf4ea376079
parentSwitchCell nits (diff)
downloadwireguard-apple-808852c547bd4d3d5d368db74d61980a5a5c2f6c.tar.xz
wireguard-apple-808852c547bd4d3d5d368db74d61980a5a5c2f6c.zip
Tunnel edit: Fix crash
This fixes a crash that happens when you: 1. Scroll to the end of the Edit screen 2. Delete a peer 3. Toggle the Activate On Demand switch Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift3
1 files changed, 2 insertions, 1 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
index 6fc0646..a8d504e 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
@@ -417,7 +417,8 @@ extension TunnelEditTableViewController {
self.activateOnDemandSetting.isActivateOnDemandEnabled = isOn
self.loadSections()
- let indexPaths = (1 ..< 4).map { IndexPath(row: $0, section: indexPath.section) }
+ let section = self.sections.firstIndex(where: { $0 == .onDemand })!
+ let indexPaths = (1 ..< 4).map { IndexPath(row: $0, section: section) }
if isOn {
if self.activateOnDemandSetting.activateOnDemandOption == .none {
self.activateOnDemandSetting.activateOnDemandOption = TunnelViewModel.defaultActivateOnDemandOption()