Extra safety

This commit is contained in:
Blatzar 2023-06-15 00:21:12 +02:00
parent 9f029de5af
commit c7fc797788

View file

@ -165,10 +165,15 @@ class PlayerGeneratorViewModel : ViewModel() {
generator?.generateLinks(clearCache = clearCache, isCasting = isCasting, {
currentLinks.add(it)
// Clone to prevent ConcurrentModificationException
normalSafeApiCall {
// Extra normalSafeApiCall since .toSet() iterates.
_currentLinks.postValue(currentLinks.toSet())
}
}, {
currentSubs.add(it)
normalSafeApiCall {
_currentSubs.postValue(currentSubs.toSet())
}
})
}