ignore ConcurrentModificationExceptions thrown at updating the directories

This commit is contained in:
tibbi 2018-06-17 22:02:52 +02:00
parent 875ba99dc0
commit 0258fc5e29
1 changed files with 32 additions and 28 deletions

View File

@ -37,6 +37,7 @@ import com.simplemobiletools.gallery.models.Directory
import com.simplemobiletools.gallery.models.Medium
import kotlinx.android.synthetic.main.activity_main.*
import java.io.*
import java.util.*
class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private val PICK_MEDIA = 2
@ -609,6 +610,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
val directoryDao = galleryDB.DirectoryDao()
val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0
try {
for (directory in dirs) {
val curMedia = mediaFetcher.getFilesFrom(directory.path, getImagesOnly, getVideosOnly, getProperDateTaken)
val newDir = if (curMedia.isEmpty()) {
@ -645,6 +647,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
}
}
}
} catch (ignored: ConcurrentModificationException) {
}
val foldersToScan = mediaFetcher.getFoldersToScan()
dirs.forEach {