From: Eric Kuck Date: Mon, 17 Dec 2018 03:11:33 +0000 (-0600) Subject: Potential fix for insertRowAtIndexPath crash X-Git-Tag: 0.0.20181104-7~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc452753a73c93f1b411a1f91d72409dfe1dac98;p=thirdparty%2Fwireguard-apple.git Potential fix for insertRowAtIndexPath crash Signed-off-by: Eric Kuck --- diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift index 4ba0cb0..e119303 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