Skip to content

Commit

Permalink
Add checks in case viewer get out of sync with collection view
Browse files Browse the repository at this point in the history
  • Loading branch information
askeland committed May 7, 2017
1 parent 5b83fdb commit 65063bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/ViewerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public class ViewerController: UIViewController {
} else {
self.scrollView.configure()
}
if !self.collectionView.indexPathsForVisibleItems.contains(self.currentIndexPath) {
if !self.collectionView.indexPathsForVisibleItems.contains(self.currentIndexPath) && self.collectionView.numberOfSections > self.currentIndexPath.section && self.collectionView.numberOfItems(inSection: self.currentIndexPath.section) > self.currentIndexPath.item {
self.collectionView.scrollToItem(at: self.currentIndexPath, at: .bottom, animated: true)
}
}
Expand Down

0 comments on commit 65063bc

Please sign in to comment.