catching some exceptions

This commit is contained in:
tibbi 2021-04-16 22:13:49 +02:00
parent 773d11d40a
commit 78467a051a
1 changed files with 10 additions and 2 deletions

View File

@ -184,9 +184,13 @@ class MyCameraImpl(val context: Context) {
if (isMarshmallow) {
toggleMarshmallowFlashlight(true)
} else {
try {
if (camera == null || params == null || camera!!.parameters == null) {
return
}
} catch (e: Exception) {
return
}
params!!.flashMode = Camera.Parameters.FLASH_MODE_TORCH
camera!!.parameters = params
@ -209,9 +213,13 @@ class MyCameraImpl(val context: Context) {
if (isMarshmallow) {
toggleMarshmallowFlashlight(false)
} else {
try {
if (camera == null || params == null || camera!!.parameters == null) {
return
}
} catch (e: Exception) {
return
}
params!!.flashMode = Camera.Parameters.FLASH_MODE_OFF
camera!!.parameters = params