forked from recloudstream/cloudstream
Fix index out of bounds
This commit is contained in:
parent
ce45351399
commit
cff67b7db3
4 changed files with 9 additions and 10 deletions
|
@ -92,7 +92,7 @@ object APIHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getLoadResponseIdFromUrl(url: String, apiName: String): Int {
|
private fun getLoadResponseIdFromUrl(url: String, apiName: String): Int {
|
||||||
return url.replace(getApiFromName(apiName).mainUrl, "").replace("/", "").hashCode()
|
return url.replace(getApiFromNameNull(apiName)?.mainUrl ?: "", "").replace("/", "").hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun LoadResponse.getId(): Int {
|
fun LoadResponse.getId(): Int {
|
||||||
|
|
|
@ -101,9 +101,7 @@ import kotlinx.coroutines.runBlocking
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
|
|
||||||
import android.widget.AbsListView
|
import android.widget.AbsListView
|
||||||
|
import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const val START_ACTION_RESUME_LATEST = 1
|
const val START_ACTION_RESUME_LATEST = 1
|
||||||
|
@ -470,11 +468,11 @@ open class ResultFragment : ResultTrailerPlayer() {
|
||||||
}
|
}
|
||||||
syncModel.addFromUrl(url)
|
syncModel.addFromUrl(url)
|
||||||
|
|
||||||
val api = getApiFromName(apiName)
|
val api = getApiFromNameNull(apiName)
|
||||||
|
|
||||||
result_episodes?.adapter =
|
result_episodes?.adapter =
|
||||||
EpisodeAdapter(
|
EpisodeAdapter(
|
||||||
api.hasDownloadSupport,
|
api?.hasDownloadSupport == true,
|
||||||
{ episodeClick ->
|
{ episodeClick ->
|
||||||
viewModel.handleAction(activity, episodeClick)
|
viewModel.handleAction(activity, episodeClick)
|
||||||
},
|
},
|
||||||
|
|
|
@ -197,10 +197,10 @@ class ResultFragmentPhone : ResultFragment() {
|
||||||
}
|
}
|
||||||
//result_poster_blur_holder?.translationY = -scrollY.toFloat()
|
//result_poster_blur_holder?.translationY = -scrollY.toFloat()
|
||||||
})
|
})
|
||||||
val api = APIHolder.getApiFromName(apiName)
|
val api = APIHolder.getApiFromNameNull(apiName)
|
||||||
|
|
||||||
if (media_route_button != null) {
|
if (media_route_button != null) {
|
||||||
val chromecastSupport = api.hasChromecastSupport
|
val chromecastSupport = api?.hasChromecastSupport == true
|
||||||
media_route_button?.alpha = if (chromecastSupport) 1f else 0.3f
|
media_route_button?.alpha = if (chromecastSupport) 1f else 0.3f
|
||||||
if (!chromecastSupport) {
|
if (!chromecastSupport) {
|
||||||
media_route_button?.setOnClickListener {
|
media_route_button?.setOnClickListener {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.APIHolder.filterProviderByPreferredMedia
|
import com.lagradost.cloudstream3.APIHolder.filterProviderByPreferredMedia
|
||||||
import com.lagradost.cloudstream3.APIHolder.filterSearchResultByFilmQuality
|
import com.lagradost.cloudstream3.APIHolder.filterSearchResultByFilmQuality
|
||||||
import com.lagradost.cloudstream3.APIHolder.getApiFromName
|
import com.lagradost.cloudstream3.APIHolder.getApiFromName
|
||||||
|
import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull
|
||||||
import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings
|
import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings
|
||||||
import com.lagradost.cloudstream3.APIHolder.getApiSettings
|
import com.lagradost.cloudstream3.APIHolder.getApiSettings
|
||||||
import com.lagradost.cloudstream3.AcraApplication.Companion.removeKey
|
import com.lagradost.cloudstream3.AcraApplication.Companion.removeKey
|
||||||
|
@ -105,11 +106,11 @@ class SearchFragment : Fragment() {
|
||||||
searchViewModel.searchAndCancel(
|
searchViewModel.searchAndCancel(
|
||||||
query = query,
|
query = query,
|
||||||
providersActive = selectedApis.filter { name ->
|
providersActive = selectedApis.filter { name ->
|
||||||
settings.contains(name) && getApiFromName(name).supportedTypes.any {
|
settings.contains(name) && getApiFromNameNull(name)?.supportedTypes?.any {
|
||||||
selectedSearchTypes.contains(
|
selectedSearchTypes.contains(
|
||||||
it
|
it
|
||||||
)
|
)
|
||||||
}
|
} == true
|
||||||
}.toSet()
|
}.toSet()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue