diff --git a/ImageViewer/ViewController.swift b/ImageViewer/ViewController.swift index 2bb2d64..41f5322 100644 --- a/ImageViewer/ViewController.swift +++ b/ImageViewer/ViewController.swift @@ -1381,7 +1381,10 @@ extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFl { if collectionView == comicCollectionView { return comics.count - } else { + } else if collectionView == scrollingCollectionView { + if metadata == nil { + return 0 + } var sum = 0 for volume in metadata.volumes { for chapter in volume.chapters { @@ -1390,6 +1393,7 @@ extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFl } return sum } + return 0 } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath)