From 6db0adced81565bafaa76d335cdc27080efd4b2b Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 14 Apr 2018 22:11:33 +0200 Subject: [PATCH] catch exceptions thrown at saving image rotation --- .../gallery/activities/ViewPagerActivity.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index ab5e68d4a..bbb3c515b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -581,12 +581,17 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View @TargetApi(Build.VERSION_CODES.N) private fun tryRotateByExif(path: String): Boolean { - return if (saveImageRotation(path, mRotationDegrees)) { - mRotationDegrees = 0 - invalidateOptionsMenu() - toast(R.string.file_saved) - true - } else { + return try { + if (saveImageRotation(path, mRotationDegrees)) { + mRotationDegrees = 0 + invalidateOptionsMenu() + toast(R.string.file_saved) + true + } else { + false + } + } catch (e: Exception) { + showErrorToast(e) false } }