Skip to content

Commit dc91665

Browse files
committed
catch and show errors thrown at starting camera preview
1 parent cdb1195 commit dc91665

File tree

1 file changed

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

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import android.graphics.SurfaceTexture
55
import android.hardware.Camera
66
import android.os.Handler
7+
import com.simplemobiletools.commons.extensions.showErrorToast
78
import com.simplemobiletools.commons.extensions.toast
89
import com.simplemobiletools.commons.helpers.isMarshmallowPlus
910
import com.simplemobiletools.commons.helpers.isNougatPlus
@@ -197,6 +198,7 @@ class MyCameraImpl(val context: Context) {
197198
try {
198199
camera!!.startPreview()
199200
} catch (e: Exception) {
201+
context.showErrorToast(e)
200202
disableFlashlight()
201203
}
202204
}

0 commit comments

Comments
 (0)