aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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()