Skip to content
This repository was archived by the owner on Jun 17, 2023. It is now read-only.

Commit b565d1e

Browse files
ensure currentPage is greater than or equal to zero to prevent Index out of range error (#68)
Co-authored-by: jlynch <[email protected]>
1 parent 03ada05 commit b565d1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/SwiftUI/PagingCollectionViewControllerBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class PagingCollectionViewControllerBuilder<ValueType: Identifiable, Page
7373

7474
private func setupOnCurrentPageChanged(_ viewController: ViewController) {
7575
viewController.onCurrentPageChanged = { [data, selection] in
76-
guard $0 < data.count else { return }
76+
guard $0 >= 0 && $0 < data.count else { return }
7777
selection?.wrappedValue = data[$0].id
7878
}
7979
}

0 commit comments

Comments
 (0)