aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Kuck <eric@bluelinelabs.com>2018-12-16 21:11:33 -0600
committerEric Kuck <eric@bluelinelabs.com>2018-12-16 21:11:33 -0600
commitfc452753a73c93f1b411a1f91d72409dfe1dac98 (patch)
tree3789b91118698df20ca4f648ffd42b305710083f
parentMore proper way to get sdk root directory (diff)
downloadwireguard-apple-fc452753a73c93f1b411a1f91d72409dfe1dac98.tar.xz
wireguard-apple-fc452753a73c93f1b411a1f91d72409dfe1dac98.zip
Potential fix for insertRowAtIndexPath crash
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift2
1 files changed, 2 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
index 4ba0cb09..e1193034 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
@@ -399,6 +399,8 @@ extension TunnelEditTableViewController {
cell.isOn = activateOnDemandSetting.isActivateOnDemandEnabled
cell.onSwitchToggled = { [weak self] isOn in
guard let self = self else { return }
+ guard isOn != self.activateOnDemandSetting.isActivateOnDemandEnabled else { return }
+
let indexPaths = (1 ..< 4).map { IndexPath(row: $0, section: indexPath.section) }
if isOn {
self.activateOnDemandSetting.isActivateOnDemandEnabled = true