Protect from automatic slide crash if there is zero item.

This commit is contained in:
WenchaoD 2017-03-03 16:41:14 +08:00
parent ebc56bf45a
commit 85de7c776e
1 changed files with 1 additions and 4 deletions

View File

@ -485,10 +485,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
@objc
fileprivate func flipNext(sender: Timer?) {
guard let _ = self.superview, let _ = self.window else {
return
}
guard !self.collectionView.isTracking else {
guard let _ = self.superview, let _ = self.window, self.numberOfItems > 0, !self.isTracking else {
return
}
self.scrollToItem(at: (self.currentIndex+1)%self.numberOfItems, animated: true)