From 8810d5abd6fa37d3bd128a21afc3c44be5f45109 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Thu, 3 Nov 2022 11:56:45 +0100 Subject: [PATCH] Trying to the dumbest crash ever --- .../main/java/com/lagradost/cloudstream3/MainAPI.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt index 190c0cf5..4b271192 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt @@ -165,7 +165,8 @@ object APIHolder { val hashSet = HashSet() val activeLangs = getApiProviderLangSettings() val hasUniversal = activeLangs.contains(AllLanguagesName) - hashSet.addAll(apis.filter { hasUniversal || activeLangs.contains(it.lang) }.map { it.name }) + hashSet.addAll(apis.filter { hasUniversal || activeLangs.contains(it.lang) } + .map { it.name }) /*val set = settingsManager.getStringSet( this.getString(R.string.search_providers_list_key), @@ -241,7 +242,13 @@ object APIHolder { } fun Context.filterProviderByPreferredMedia(hasHomePageIsRequired: Boolean = true): List { - val default = enumValues().sorted().filter { it != TvType.NSFW }.map { it.ordinal } + // We are getting the weirdest crash ever done: + // java.lang.ClassCastException: com.lagradost.cloudstream3.TvType cannot be cast to com.lagradost.cloudstream3.TvType + // enumValues() might be the cause, hence I am trying TvType.values() + val default = TvType.values() + .sorted() + .filter { it != TvType.NSFW } + .map { it.ordinal } val defaultSet = default.map { it.toString() }.toSet() val currentPrefMedia = try { PreferenceManager.getDefaultSharedPreferences(this)