fix scrollToItem forces crash in case of index out of range
This commit is contained in:
parent
3acbd3e987
commit
68b82f91e1
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue