Kingfisher: Fatal Error in prefetcher

I use the ImagePrefetcher to cache photos before I need them, so I frequently start and stop 2 prefetchers with several photos.

I occasionally run into a problem: Fatal Error: Can’t form Range with end < start at this line in ImagePrefetcher.downloadAndCacheResource(resource: Resource):

let pendingResources = self.prefetchResources[self.requestedCount..<self.prefetchResources.count]

Is it that stop() was called on the prefetcher and a downloadTask is trying to stop itself, but it’s actually already done (e.g requestedCount == prefetchResources.count)?

(also thanks for making this library, aside from this crash, it’s great)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@mihaibulic Thanks for letting me know it.

May I know the number of images you are trying to fetch as well as the maxConcurrentDownloads you are using? It might be help for me to track what happens.

Thanks!