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
[TIMOB-20202] Android: Camera.open() can throw a RuntimeException. #7616
Conversation
camera = Camera.open(cameraId); | ||
} | ||
} catch (Exception e) { | ||
Log.e(TAG, "Could not open camera. Camera may be in use by another process or device policy manager has disabled the camera.", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be good to have camera = null
in the catch statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if statement before the try ensures camera will be null.
Code reviewed. Everything looks good. 👍 |
Is there a sample code you can provide to make this crash to test this? |
I have been unable to reproduce the issue on my available devices but I am getting crash reports from Crittercism that relate to this. See example stack trace:
|
Understood. Code reviewed. Tested with Kitchen Sink to ensure Camera is okay. PR approved. Merging |
[TIMOB-20202] Android: Camera.open() can throw a RuntimeException.
Issue: Added try catch block to prevent crashes when Camera.open() fails at Runtime.