From ad1a721f8f577e18e7824210dbaff71ed9b0e324 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 8 Apr 2018 11:13:31 +0200 Subject: [PATCH] catch and show exceptions thrown at rotating saved image --- .../camera/helpers/PhotoProcessor.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt index 7863a4f2..13f61f56 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt @@ -97,12 +97,16 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId } } - val fileExif = ExifInterface(path) - - image.compress(Bitmap.CompressFormat.JPEG, activity.config.photoQuality, fos) - activity.saveImageRotation(path, totalRotation) + try { + image.compress(Bitmap.CompressFormat.JPEG, activity.config.photoQuality, fos) + activity.saveImageRotation(path, totalRotation) + } catch (e: Exception) { + activity.showErrorToast(e) + return "" + } if (activity.config.savePhotoMetadata) { + val fileExif = ExifInterface(path) tempExif.copyTo(fileExif) }