catching some exceptions
This commit is contained in:
parent
773d11d40a
commit
78467a051a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue