avoid concurrent arraylist modification at portrait fetching

This commit is contained in:
tibbi 2019-09-30 15:04:55 +02:00
parent 9f7afabc7f
commit ff79038efa
1 changed files with 3 additions and 1 deletions

View File

@ -620,12 +620,14 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
}
if (config.filterMedia and TYPE_PORTRAITS != 0) {
val foldersToAdd = ArrayList<String>()
for (folder in foldersToScan) {
val allFiles = File(folder).listFiles() ?: continue
allFiles.filter { it.isDirectory && it.name.startsWith("img_", true) }.forEach {
foldersToScan.add(it.absolutePath)
foldersToAdd.add(it.absolutePath)
}
}
foldersToScan.addAll(foldersToAdd)
}
val shouldShowHidden = config.shouldShowHidden