From 10dcb51cae15b986d57015c8c5f9e8049546d520 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 24 Jan 2018 22:50:40 +0100 Subject: [PATCH] catch all exceptions at MarshmallowCamera --- .../flashlight/helpers/MarshmallowCamera.kt | 5 ++--- build.gradle | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MarshmallowCamera.kt b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MarshmallowCamera.kt index 5d35921..e07198c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MarshmallowCamera.kt +++ b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MarshmallowCamera.kt @@ -2,7 +2,6 @@ package com.simplemobiletools.flashlight.helpers import android.annotation.TargetApi import android.content.Context -import android.hardware.camera2.CameraAccessException import android.hardware.camera2.CameraManager import android.os.Build import android.os.Handler @@ -18,7 +17,7 @@ internal class MarshmallowCamera constructor(val context: Context) { init { try { cameraId = manager.cameraIdList[0] ?: "0" - } catch (ignored: CameraAccessException) { + } catch (ignored: Exception) { } } @@ -26,7 +25,7 @@ internal class MarshmallowCamera constructor(val context: Context) { fun toggleMarshmallowFlashlight(bus: Bus, enable: Boolean) { try { manager.setTorchMode(cameraId!!, enable) - } catch (e: CameraAccessException) { + } catch (e: Exception) { val mainRunnable = Runnable { bus.post(Events.CameraUnavailable()) } diff --git a/build.gradle b/build.gradle index bbd754e..66c86d6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.20' + ext.kotlin_version = '1.2.21' repositories { jcenter()