mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
catching some exceptions at adding media in db
This commit is contained in:
parent
9c7c995251
commit
af96e77313
1 changed files with 9 additions and 6 deletions
|
@ -401,15 +401,18 @@ fun Context.rescanFolderMediaSync(path: String) {
|
|||
val newMedia = it
|
||||
val mediumDao = galleryDB.MediumDao()
|
||||
val media = newMedia.filter { it is Medium } as ArrayList<Medium>
|
||||
mediumDao.insertAll(media)
|
||||
try {
|
||||
mediumDao.insertAll(media)
|
||||
|
||||
cached.forEach {
|
||||
if (!newMedia.contains(it)) {
|
||||
val mediumPath = (it as? Medium)?.path
|
||||
if (mediumPath != null) {
|
||||
deleteDBPath(mediumDao, mediumPath)
|
||||
cached.forEach {
|
||||
if (!newMedia.contains(it)) {
|
||||
val mediumPath = (it as? Medium)?.path
|
||||
if (mediumPath != null) {
|
||||
deleteDBPath(mediumDao, mediumPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
}.execute()
|
||||
|
|
Loading…
Reference in a new issue