forked from recloudstream/cloudstream
fix: Edge case bug of setting preferred media without any provider that has mainPage (#231)
This commit is contained in:
parent
f38ffc8ce9
commit
97641d5459
1 changed files with 3 additions and 2 deletions
|
@ -347,8 +347,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
settingsManager.edit()
|
||||
.putInt(getString(R.string.preferred_media_settings), prefValues[it])
|
||||
.apply()
|
||||
val apiRandom = AppUtils.filterProviderByPreferredMedia(apis, prefValues[it]).random()
|
||||
context?.setKey(HOMEPAGE_API, apiRandom.name)
|
||||
val apilist = AppUtils.filterProviderByPreferredMedia(apis, prefValues[it])
|
||||
val apiRandom = if (apilist?.size > 0) { apilist.random().name } else { "" }
|
||||
context?.setKey(HOMEPAGE_API, apiRandom)
|
||||
context?.initRequestClient()
|
||||
}
|
||||
return@setOnPreferenceClickListener true
|
||||
|
|
Loading…
Reference in a new issue