android; wrap call to _camera.autoFocus into try/catch
This commit is contained in:
parent
8024d6992f
commit
5097f95c6f
|
@ -371,12 +371,17 @@ class RCTCameraViewFinder extends TextureView implements TextureView.SurfaceText
|
|||
|
||||
List<String> supportedFocusModes = params.getSupportedFocusModes();
|
||||
if (supportedFocusModes != null && supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
|
||||
_camera.autoFocus(new Camera.AutoFocusCallback() {
|
||||
@Override
|
||||
public void onAutoFocus(boolean b, Camera camera) {
|
||||
// currently set to auto-focus on single touch
|
||||
}
|
||||
});
|
||||
try {
|
||||
_camera.autoFocus(new Camera.AutoFocusCallback() {
|
||||
@Override
|
||||
public void onAutoFocus(boolean b, Camera camera) {
|
||||
// currently set to auto-focus on single touch
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
// just print stack trace, we don't want to crash by autoFocus fails
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue