diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt index 550ef9ad..1940c995 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraTwo.kt @@ -251,10 +251,13 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie } private val imageAvailableListener = ImageReader.OnImageAvailableListener { reader -> - val buffer = reader.acquireNextImage().planes.first().buffer - val bytes = ByteArray(buffer.remaining()) - buffer.get(bytes) - PhotoProcessor(mActivity, mTargetUri, mRotationAtCapture, getJPEGOrientation(), mUseFrontCamera).execute(bytes) + try { + val buffer = reader.acquireNextImage().planes.first().buffer + val bytes = ByteArray(buffer.remaining()) + buffer.get(bytes) + PhotoProcessor(mActivity, mTargetUri, mRotationAtCapture, getJPEGOrientation(), mUseFrontCamera).execute(bytes) + } catch (e: Exception) { + } } private fun getJPEGOrientation(): Int {