Skip to content

Conversation

simonkim
Copy link

videoOutput! member of Camera class set to nil before throwing CameraError and that causes Camera.deinit()crash with

fatal error: unexpectedly found nil while unwrapping an Optional value

while attempting to access videoOutput!

To solve the issue, these changes:

  1. Fix iOS GPUImageTests build failure by correcting file locations in xcodeproj
  2. Add testCameraError() test case to harness the code reproduces the crash
  3. Fix the crash by assigning videoOutput! with a valid object, not nil

The test case reproduces runtime crash 'fatal error: unexpectedly found
nil while unwrapping an Optional value'
Setting nil to videoOutput before throwing an Exception in Camera.init()
causes deinit() fails to access self.videoOutput. Instead, it's safer to
initialize videoOutput with a proper value.
With this change, testCameraError() in iOS GPUImageTests passes
@b3ll
Copy link

b3ll commented Feb 17, 2017

💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants