catching some exceptions at adding media in db

This commit is contained in:
tibbi 2019-07-28 19:50:15 +02:00
parent 9c7c995251
commit af96e77313

View file

@ -401,15 +401,18 @@ fun Context.rescanFolderMediaSync(path: String) {
val newMedia = it val newMedia = it
val mediumDao = galleryDB.MediumDao() val mediumDao = galleryDB.MediumDao()
val media = newMedia.filter { it is Medium } as ArrayList<Medium> val media = newMedia.filter { it is Medium } as ArrayList<Medium>
mediumDao.insertAll(media) try {
mediumDao.insertAll(media)
cached.forEach { cached.forEach {
if (!newMedia.contains(it)) { if (!newMedia.contains(it)) {
val mediumPath = (it as? Medium)?.path val mediumPath = (it as? Medium)?.path
if (mediumPath != null) { if (mediumPath != null) {
deleteDBPath(mediumDao, mediumPath) deleteDBPath(mediumDao, mediumPath)
}
} }
} }
} catch (ignored: Exception) {
} }
} }
}.execute() }.execute()