From 8effeedd7d9cd859c6d677a898cbe14ca42eee81 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 18:02:06 +0100 Subject: [PATCH] catch and show exceptions thrown at fetching path of MediaActivity --- .../gallery/activities/MediaActivity.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 29b64841d..97becbd1c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -81,7 +81,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } media_refresh_layout.setOnRefreshListener { getMedia() } - mPath = intent.getStringExtra(DIRECTORY) + try { + mPath = intent.getStringExtra(DIRECTORY) + } catch (e: Exception) { + showErrorToast(e) + finish() + return + } + storeStateVariables() if (mShowAll) supportActionBar?.setDisplayHomeAsUpEnabled(false)