From dc91665ba7c7703b31beb7cb750994a68b96a570 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Feb 2022 10:16:28 +0100 Subject: [PATCH] catch and show errors thrown at starting camera preview --- .../com/simplemobiletools/flashlight/helpers/MyCameraImpl.kt | 2 ++ 1 file changed, 2 insertions(+) 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 99b3bf3..e69997d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyCameraImpl.kt +++ b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyCameraImpl.kt @@ -4,6 +4,7 @@ import android.content.Context import android.graphics.SurfaceTexture import android.hardware.Camera import android.os.Handler +import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.helpers.isMarshmallowPlus import com.simplemobiletools.commons.helpers.isNougatPlus @@ -197,6 +198,7 @@ class MyCameraImpl(val context: Context) { try { camera!!.startPreview() } catch (e: Exception) { + context.showErrorToast(e) disableFlashlight() } }