mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
fix media inserting ConcurrentModificationException in a proper way
This commit is contained in:
parent
3aaa17a02d
commit
4f724786b2
1 changed files with 2 additions and 4 deletions
|
@ -633,14 +633,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
}
|
||||
|
||||
private fun gotMedia(media: ArrayList<Medium>, isFromCache: Boolean = false) {
|
||||
val mediaToInsert = media.clone() as ArrayList<Medium>
|
||||
Thread {
|
||||
mLatestMediaId = getLatestMediaId()
|
||||
mLatestMediaDateId = getLatestMediaByDateId()
|
||||
if (!isFromCache) {
|
||||
try {
|
||||
galleryDB.MediumDao().insertAll(media)
|
||||
} catch (e: ConcurrentModificationException) {
|
||||
}
|
||||
galleryDB.MediumDao().insertAll(mediaToInsert)
|
||||
}
|
||||
}.start()
|
||||
|
||||
|
|
Loading…
Reference in a new issue