add some camera null checks at autofocusing
This commit is contained in:
parent
95c763cd62
commit
eb6b5c143d
|
@ -350,6 +350,9 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
||||||
mCamera!!.parameters = mParameters
|
mCamera!!.parameters = mParameters
|
||||||
try {
|
try {
|
||||||
mCamera!!.autoFocus { success, camera ->
|
mCamera!!.autoFocus { success, camera ->
|
||||||
|
if (camera == null || mCamera == null) {
|
||||||
|
return@autoFocus
|
||||||
|
}
|
||||||
camera.cancelAutoFocus()
|
camera.cancelAutoFocus()
|
||||||
val focusModes = mParameters!!.supportedFocusModes
|
val focusModes = mParameters!!.supportedFocusModes
|
||||||
if (focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE))
|
if (focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE))
|
||||||
|
|
Loading…
Reference in New Issue