fix scrollToItem forces crash in case of index out of range

This commit is contained in:
thrillseek3r 2021-12-20 19:11:52 +03:00
parent 3acbd3e987
commit 68b82f91e1
1 changed files with 1 additions and 1 deletions

View File

@ -512,7 +512,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
@objc(scrollToItemAtIndex:animated:)
open func scrollToItem(at index: Int, animated: Bool) {
guard index < self.numberOfItems else {
fatalError("index \(index) is out of range [0...\(self.numberOfItems-1)]")
return
}
let indexPath = { () -> IndexPath in
if let indexPath = self.possibleTargetingIndexPath, indexPath.item == index {