fix: handle collectionView() when metadata == nil

This commit is contained in:
2026-07-12 03:26:08 +02:00
parent 400febc7b3
commit dd7528dfe4
+5 -1
View File
@@ -1381,7 +1381,10 @@ extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFl
{ {
if collectionView == comicCollectionView { if collectionView == comicCollectionView {
return comics.count return comics.count
} else { } else if collectionView == scrollingCollectionView {
if metadata == nil {
return 0
}
var sum = 0 var sum = 0
for volume in metadata.volumes { for volume in metadata.volumes {
for chapter in volume.chapters { for chapter in volume.chapters {
@@ -1390,6 +1393,7 @@ extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFl
} }
return sum return sum
} }
return 0
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath)