catch exceptions thrown at deleting stored directory paths

This commit is contained in:
tibbi 2019-07-02 15:17:42 +02:00
parent 0dcb96d565
commit be62c4ed9a

View file

@ -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 {
directoryDao.deleteDirPath(it.path) try {
directoryDao.deleteDirPath(it.path)
} catch (ignored: Exception) {
}
} }
} }