From c1ea435343b86d0961bea3b0a3b4e2f600ed9e12 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 5 May 2017 11:33:12 +0200 Subject: [PATCH] make sure the camera is not null when setting up the preview after measuring --- .../main/kotlin/com/simplemobiletools/camera/Preview.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/Preview.kt b/app/src/main/kotlin/com/simplemobiletools/camera/Preview.kt index 8e4ddf94..c333967f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/Preview.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/Preview.kt @@ -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() + } } } }