From 78467a051a9bb3a92c96e436c36a8295b2694785 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 16 Apr 2021 22:13:49 +0200 Subject: [PATCH] catching some exceptions --- .../flashlight/helpers/MyCameraImpl.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyCameraImpl.kt b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyCameraImpl.kt index d58313c..99b3bf3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyCameraImpl.kt +++ b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyCameraImpl.kt @@ -184,7 +184,11 @@ class MyCameraImpl(val context: Context) { if (isMarshmallow) { toggleMarshmallowFlashlight(true) } else { - if (camera == null || params == null || camera!!.parameters == null) { + try { + if (camera == null || params == null || camera!!.parameters == null) { + return + } + } catch (e: Exception) { return } @@ -209,7 +213,11 @@ class MyCameraImpl(val context: Context) { if (isMarshmallow) { toggleMarshmallowFlashlight(false) } else { - if (camera == null || params == null || camera!!.parameters == null) { + try { + if (camera == null || params == null || camera!!.parameters == null) { + return + } + } catch (e: Exception) { return }