Commit 7c53b343 authored by Geoffrey Métais's avatar Geoffrey Métais

Medialibrary: Catch UnsupportedOperationException

Workaround for crash on 1+ devices. Wrong implementation of ListIterator
seems to be used.
parent d0eaf470
......@@ -104,16 +104,18 @@ fun List<MediaWrapper>.getWithMLMeta() : List<MediaWrapper> {
fun MutableList<MediaWrapper>.updateWithMLMeta() : MutableList<MediaWrapper> {
val iter = listIterator()
val ml = VLCApplication.getMLInstance()
while (iter.hasNext()) {
val media = iter.next()
if (media.id == 0L) {
val mw = ml.findMedia(media)
if (mw!!.id != 0L) {
if (mw.type == MediaWrapper.TYPE_ALL) mw.type = media.getType()
iter.set(mw)
try {
while (iter.hasNext()) {
val media = iter.next()
if (media.id == 0L) {
val mw = ml.findMedia(media)
if (mw!!.id != 0L) {
if (mw.type == MediaWrapper.TYPE_ALL) mw.type = media.getType()
iter.set(mw)
}
}
}
}
} catch (ignored: Exception) {}
return this
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment