diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerGeneratorViewModel.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerGeneratorViewModel.kt index 13171d40..1b13b519 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerGeneratorViewModel.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerGeneratorViewModel.kt @@ -165,10 +165,15 @@ class PlayerGeneratorViewModel : ViewModel() { generator?.generateLinks(clearCache = clearCache, isCasting = isCasting, { currentLinks.add(it) // Clone to prevent ConcurrentModificationException - _currentLinks.postValue(currentLinks.toSet()) + normalSafeApiCall { + // Extra normalSafeApiCall since .toSet() iterates. + _currentLinks.postValue(currentLinks.toSet()) + } }, { currentSubs.add(it) - _currentSubs.postValue(currentSubs.toSet()) + normalSafeApiCall { + _currentSubs.postValue(currentSubs.toSet()) + } }) }