From c7fc797788fb2c57387905d216275fce3e7dfcad Mon Sep 17 00:00:00 2001 From: Blatzar <> Date: Thu, 15 Jun 2023 00:21:12 +0200 Subject: [PATCH] Extra safety --- .../cloudstream3/ui/player/PlayerGeneratorViewModel.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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()) + } }) }