From a037fd5761d474a325070f2ff75cb23b6b21974c Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 7 Jun 2018 11:33:18 +0200 Subject: [PATCH] catch all exceptions thrown at opening the camera --- .../com/simplemobiletools/camera/views/PreviewCameraTwo.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt index 7ab76669..0998c89f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt @@ -169,15 +169,15 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie } } + @SuppressLint("MissingPermission") private fun openCamera(width: Int, height: Int) { - setupCameraOutputs(width, height) try { + setupCameraOutputs(width, height) if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) { throw RuntimeException("Time out waiting to lock camera opening.") } getCameraManager().openCamera(mCameraId, cameraStateCallback, mBackgroundHandler) - } catch (e: InterruptedException) { - } catch (e: SecurityException) { + } catch (e: Exception) { } }