make sure the camera is not null when setting up the preview after measuring

This commit is contained in:
tibbi 2017-05-05 11:33:12 +02:00
parent 28bb406d42
commit c1ea435343
1 changed files with 5 additions and 3 deletions

View File

@ -462,9 +462,11 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
}
if (mSetupPreviewAfterMeasure) {
mSetupPreviewAfterMeasure = false
mCamera?.stopPreview()
setupPreview()
if (mCamera != null) {
mSetupPreviewAfterMeasure = false
mCamera!!.stopPreview()
setupPreview()
}
}
}
}