From: Roopesh Chander Date: Fri, 26 Oct 2018 13:30:19 +0000 (+0530) Subject: Tunnel detail: Account for status section in peer index calculations X-Git-Tag: 0.0.20181104-1~166 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3aed009eb67702fd2eb6e0e987e464123386fbe3;p=thirdparty%2Fwireguard-apple.git Tunnel detail: Account for status section in peer index calculations Signed-off-by: Roopesh Chander --- diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift index f5a6936..c24828b 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift @@ -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