|
@@ -431,13 +431,17 @@ extension NCMedia: UICollectionViewDataSource {
|
|
}
|
|
}
|
|
|
|
|
|
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
|
|
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
|
|
- let metadata = metadatas[indexPath.row]
|
|
|
|
- NCOperationQueue.shared.downloadThumbnail(metadata: metadata, activeUrl: self.appDelegate.activeUrl, view: self.collectionView as Any, indexPath: indexPath)
|
|
|
|
|
|
+ if indexPath.row < metadatas.count {
|
|
|
|
+ let metadata = metadatas[indexPath.row]
|
|
|
|
+ NCOperationQueue.shared.downloadThumbnail(metadata: metadata, activeUrl: self.appDelegate.activeUrl, view: self.collectionView as Any, indexPath: indexPath)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
|
|
func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
|
|
- let metadata = metadatas[indexPath.row]
|
|
|
|
- NCOperationQueue.shared.cancelDownloadThumbnail(metadata: metadata)
|
|
|
|
|
|
+ if indexPath.row < metadatas.count {
|
|
|
|
+ let metadata = metadatas[indexPath.row]
|
|
|
|
+ NCOperationQueue.shared.cancelDownloadThumbnail(metadata: metadata)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|