Skip to content

Commit 78467a0

Browse files
committed
catching some exceptions
1 parent 773d11d commit 78467a0

File tree

1 file changed

+10
-2
lines changed
  • app/src/main/kotlin/com/simplemobiletools/flashlight/helpers

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@ class MyCameraImpl(val context: Context) {
184184
if (isMarshmallow) {
185185
toggleMarshmallowFlashlight(true)
186186
} else {
187-
if (camera == null || params == null || camera!!.parameters == null) {
187+
try {
188+
if (camera == null || params == null || camera!!.parameters == null) {
189+
return
190+
}
191+
} catch (e: Exception) {
188192
return
189193
}
190194

@@ -209,7 +213,11 @@ class MyCameraImpl(val context: Context) {
209213
if (isMarshmallow) {
210214
toggleMarshmallowFlashlight(false)
211215
} else {
212-
if (camera == null || params == null || camera!!.parameters == null) {
216+
try {
217+
if (camera == null || params == null || camera!!.parameters == null) {
218+
return
219+
}
220+
} catch (e: Exception) {
213221
return
214222
}
215223

0 commit comments

Comments
 (0)