try removing temp folder only if the path isnt empty

This commit is contained in:
tibbi 2017-12-24 14:08:04 +01:00
parent 4e530d0517
commit 6c7e406dad

View file

@ -209,6 +209,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
} }
private fun removeTempFolder() { private fun removeTempFolder() {
if (config.tempFolderPath.isNotEmpty()) {
val newFolder = File(config.tempFolderPath) val newFolder = File(config.tempFolderPath)
if (newFolder.exists() && newFolder.isDirectory) { if (newFolder.exists() && newFolder.isDirectory) {
if (newFolder.list()?.isEmpty() == true) { if (newFolder.list()?.isEmpty() == true) {
@ -217,6 +218,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
} }
config.tempFolderPath = "" config.tempFolderPath = ""
} }
}
private fun tryloadGallery() { private fun tryloadGallery() {
handlePermission(PERMISSION_WRITE_STORAGE) { handlePermission(PERMISSION_WRITE_STORAGE) {