mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Catch more camera exceptions.
Some devices will simply fail to open the camera with a runtime exception. In this case, all we can do is catch it and report the error.
This commit is contained in:
parent
8ec3cf6a43
commit
668e8dee5d
@ -34,9 +34,20 @@ public class Camera1Controller {
|
||||
|
||||
if (Camera.getNumberOfCameras() <= 0) {
|
||||
onCameraUnavailable();
|
||||
return;
|
||||
}
|
||||
|
||||
camera = Camera.open(cameraId);
|
||||
try {
|
||||
camera = Camera.open(cameraId);
|
||||
} catch (Exception e) {
|
||||
onCameraUnavailable();
|
||||
return;
|
||||
}
|
||||
|
||||
if (camera == null) {
|
||||
onCameraUnavailable();
|
||||
return;
|
||||
}
|
||||
|
||||
Camera.Parameters params = camera.getParameters();
|
||||
Camera.Size maxSize = getMaxSupportedPreviewSize(camera);
|
||||
|
Loading…
Reference in New Issue
Block a user