Skip to content

Commit 10dcb51

Browse files
committed
catch all exceptions at MarshmallowCamera
1 parent 6a702ac commit 10dcb51

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MarshmallowCamera.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.simplemobiletools.flashlight.helpers
22

33
import android.annotation.TargetApi
44
import android.content.Context
5-
import android.hardware.camera2.CameraAccessException
65
import android.hardware.camera2.CameraManager
76
import android.os.Build
87
import android.os.Handler
@@ -18,15 +17,15 @@ internal class MarshmallowCamera constructor(val context: Context) {
1817
init {
1918
try {
2019
cameraId = manager.cameraIdList[0] ?: "0"
21-
} catch (ignored: CameraAccessException) {
20+
} catch (ignored: Exception) {
2221
}
2322
}
2423

2524
@TargetApi(Build.VERSION_CODES.M)
2625
fun toggleMarshmallowFlashlight(bus: Bus, enable: Boolean) {
2726
try {
2827
manager.setTorchMode(cameraId!!, enable)
29-
} catch (e: CameraAccessException) {
28+
} catch (e: Exception) {
3029
val mainRunnable = Runnable {
3130
bus.post(Events.CameraUnavailable())
3231
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.2.20'
4+
ext.kotlin_version = '1.2.21'
55

66
repositories {
77
jcenter()

0 commit comments

Comments
 (0)