From 8d7853e4f06d510b3d43849736fd03c6b70313ac Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 09:59:18 +0100 Subject: [PATCH] catch exceptions thrown at trying to show the image on a map --- .../gallery/activities/ViewPagerActivity.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 64b5e02e6..0d1033a2f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -644,7 +644,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun showOnMap() { - val exif = ExifInterface(getCurrentPath()) + val exif: ExifInterface + try { + exif = ExifInterface(getCurrentPath()) + } catch (e: Exception) { + showErrorToast(e) + return + } val lat = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE) val lat_ref = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF) val lon = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE)