From 6c7e406dad7e89ee8b50c0c20fb535cb5e1be329 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 24 Dec 2017 14:08:04 +0100 Subject: [PATCH] try removing temp folder only if the path isnt empty --- .../gallery/activities/MainActivity.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 29bfea737..b970bd9e7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -209,13 +209,15 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun removeTempFolder() { - val newFolder = File(config.tempFolderPath) - if (newFolder.exists() && newFolder.isDirectory) { - if (newFolder.list()?.isEmpty() == true) { - deleteFile(newFolder, true) + if (config.tempFolderPath.isNotEmpty()) { + val newFolder = File(config.tempFolderPath) + if (newFolder.exists() && newFolder.isDirectory) { + if (newFolder.list()?.isEmpty() == true) { + deleteFile(newFolder, true) + } } + config.tempFolderPath = "" } - config.tempFolderPath = "" } private fun tryloadGallery() {