diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index 59cb44f5e..ff62abdd2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -471,14 +471,16 @@ fun Context.loadImage(type: Int, path: String, target: MySquareImageView, horizo } fun Context.addTempFolderIfNeeded(dirs: ArrayList): ArrayList { - val directories = ArrayList() val tempFolderPath = config.tempFolderPath - if (tempFolderPath.isNotEmpty()) { + return if (tempFolderPath.isNotEmpty()) { + val directories = ArrayList() val newFolder = Directory(null, tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L, getPathLocation(tempFolderPath), 0) directories.add(newFolder) + directories.addAll(dirs) + directories + } else { + dirs } - directories.addAll(dirs) - return directories } fun Context.getPathLocation(path: String): Int {