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() {