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 3179cb9f..03d97e87 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 @@ -184,16 +184,20 @@ class PlayerGeneratorViewModel : ViewModel() { _loadingLinks.postValue(Resource.Loading()) val loadingState = safeApiCall { generator?.generateLinks(type = type, clearCache = clearCache, callback = { - currentLinks.add(it) - // Clone to prevent ConcurrentModificationException - normalSafeApiCall { - // Extra normalSafeApiCall since .toSet() iterates. - _currentLinks.postValue(currentLinks.toSet()) + if (it.first?.url?.isNotEmpty() == true) { + currentLinks.add(it) + // Clone to prevent ConcurrentModificationException + normalSafeApiCall { + // Extra normalSafeApiCall since .toSet() iterates. + _currentLinks.postValue(currentLinks.toSet()) + } } }, subtitleCallback = { - currentSubs.add(it) - normalSafeApiCall { - _currentSubs.postValue(currentSubs.toSet()) + if (it.url.isNotEmpty()) { + currentSubs.add(it) + normalSafeApiCall { + _currentSubs.postValue(currentSubs.toSet()) + } } }) }