From 6e5a52e440a2b8ffcbb44473ff4c390f54a04803 Mon Sep 17 00:00:00 2001 From: yueehaoo <153455752+yueehaoo@users.noreply.github.com> Date: Thu, 14 Dec 2023 03:49:42 +0800 Subject: [PATCH] Fixing Source List Displaying Empty Items (#810) * Fixing source list displaying empty items --- .../ui/player/RepoLinkGenerator.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/RepoLinkGenerator.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/RepoLinkGenerator.kt index d55da57c..5626e9a0 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/RepoLinkGenerator.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/RepoLinkGenerator.kt @@ -112,7 +112,7 @@ class RepoLinkGenerator( isCasting = LoadType.Chromecast == type, subtitleCallback = { file -> val correctFile = PlayerSubtitleHelper.getSubtitleData(file) - if (!currentSubsUrls.contains(correctFile.url)) { + if (correctFile.url.isNotEmpty() && !currentSubsUrls.contains(correctFile.url)) { currentSubsUrls.add(correctFile.url) // this part makes sure that all names are unique for UX @@ -135,15 +135,15 @@ class RepoLinkGenerator( }, callback = { link -> Log.d(TAG, "Loaded ExtractorLink: $link") - if (!currentLinks.contains(link.url)) { - if (!currentLinkCache.contains(link)) { - currentLinks.add(link.url) - if (allowedTypes.contains(link.type)) { - callback(Pair(link, null)) - } - currentLinkCache.add(link) - //linkCache[index] = currentLinkCache + if (link.url.isNotEmpty() && !currentLinks.contains(link.url) && !currentLinkCache.contains(link)) { + currentLinks.add(link.url) + + if (allowedTypes.contains(link.type)) { + callback(Pair(link, null)) } + + currentLinkCache.add(link) + // linkCache[index] = currentLinkCache } } )