Tunnel detail: Account for status section in peer index calculations

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-10-26 19:00:19 +05:30
parent 3f4d12c404
commit 3aed009eb6
1 changed files with 2 additions and 2 deletions

View File

@ -103,9 +103,9 @@ extension TunnelDetailTableViewController {
return interfaceData.filterFieldsWithValueOrControl(interfaceFields: interfaceFieldsBySection[section - 1]).count
} else if ((numberOfPeers > 0) && (section < (1 + numberOfInterfaceSections + numberOfPeers * numberOfPeerSections))) {
// Peer
let peerIndex = Int((section - numberOfInterfaceSections) / numberOfPeerSections)
let peerIndex = Int((section - 1 - numberOfInterfaceSections) / numberOfPeerSections)
let peerData = tunnelViewModel.peersData[peerIndex]
let peerSectionIndex = (section - numberOfInterfaceSections) % numberOfPeerSections
let peerSectionIndex = (section - 1 - numberOfInterfaceSections) % numberOfPeerSections
return peerData.filterFieldsWithValueOrControl(peerFields: peerFieldsBySection[peerSectionIndex]).count
} else {
// Delete tunnel