Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On iOS Simulator, try Camera() fails to throw CameraError but crashes in deinit() #52

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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