swift-snapshot-testing icon indicating copy to clipboard operation
swift-snapshot-testing copied to clipboard

Occasionally getting error "SnapshotTesting/UIImage.swift:24: Fatal error: Unexpectedly found nil while unwrapping an Optional value"

Open simondelphia opened this issue 2 years ago • 5 comments

Occasionally getting an error on CI

SnapshotTesting/UIImage.swift:24: Fatal error: Unexpectedly found nil while unwrapping an Optional value

This is referring to a line here: https://github.com/pointfreeco/swift-snapshot-testing/blob/main/Sources/SnapshotTesting/Snapshotting/UIImage.swift

Which has some force unwraps.

I'm not sure why this is happening — possibly not even related to this repo.

But instead of force unwrapping and leading to a fatal error, this could presumably be handled more gracefully instead.

simondelphia avatar Jul 05 '22 22:07 simondelphia

Hello @simondelphia, I got the same error, please check if *.png files are ok, in my case my was corrupted.

niemmi-gs avatar Sep 15 '22 13:09 niemmi-gs

Yes they are corrupted. The cause of my issue has nothing to do with this library, so I didn't get into the details. Just would be nice if the library failed more gracefully.

simondelphia avatar Sep 15 '22 13:09 simondelphia

@simondelphia But do you know how you resolved this issue?

nhaarman avatar May 01 '23 09:05 nhaarman