mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
catch exceptions thrown at deleting stored directory paths
This commit is contained in:
@ -667,7 +667,10 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
|
|||||||
fun Context.removeInvalidDBDirectories(dirs: ArrayList<Directory>? = null, directoryDao: DirectoryDao = galleryDB.DirectoryDao()) {
|
fun Context.removeInvalidDBDirectories(dirs: ArrayList<Directory>? = null, directoryDao: DirectoryDao = galleryDB.DirectoryDao()) {
|
||||||
val dirsToCheck = dirs ?: directoryDao.getAll()
|
val dirsToCheck = dirs ?: directoryDao.getAll()
|
||||||
dirsToCheck.filter { !it.areFavorites() && !it.isRecycleBin() && !File(it.path).exists() && it.path != config.tempFolderPath }.forEach {
|
dirsToCheck.filter { !it.areFavorites() && !it.isRecycleBin() && !File(it.path).exists() && it.path != config.tempFolderPath }.forEach {
|
||||||
|
try {
|
||||||
directoryDao.deleteDirPath(it.path)
|
directoryDao.deleteDirPath(it.path)
|
||||||
|
} catch (ignored: Exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user