calm / KenBurns

A little Swift utility that performs the Ken Burns effect on an image
http://calm.com/jobs
MIT License
30 stars 18 forks source link

fun queueNextImage -> Fatal error: Unexpectedly found nil while unwrapping an Optional value: file #20

Open steve111MV opened 4 years ago

steve111MV commented 4 years ago

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file Pods/KenBurns/KenBurns/Classes/KenBurns.swift, line 327

I'm not using a Queue but the library is trying to load a next image from the queue. in the following line 327

func queueNextImage() {
        if remoteQueue  { 
            if imagePlaceholders == nil {
                nextImageView.kf.setImage(with: imageURLs!.read()!, placeholder: nil, options: [.transition(.fade(0.2))])
                nextImageView.kf.indicatorType = .activity
            } else {
                nextImageView.kf.setImage(with: imageURLs!.read()!, placeholder: nil, options: [.transition(.fade(0.2))])
                nextImageView.kf.indicatorType = .activity
            }
        } else {
            nextImageView.image = imageQueue!.read() //Line 327
        }
    }
paxi-ml commented 4 years ago

You can just add a guard in the meantime

guard let queue = imageQueue else { nextImageView.image = currentImageView.image return }