Potential fix for insertRowAtIndexPath crash

This commit is contained in:
Eric Kuck 2018-12-16 21:11:33 -06:00
parent 971e9404ec
commit 92781a6eb9
1 changed files with 2 additions and 0 deletions

View File

@ -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