en/AniPlay: added invalid index safeguard to video server and type name

This commit is contained in:
Josef František Straka 2024-11-08 17:30:42 +01:00
parent 03dcdc75f3
commit 4851cddb90

View file

@ -426,11 +426,17 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
}
private fun getServerName(value: String): String {
val index = PREF_SERVER_ENTRY_VALUES.indexOf(value)
if (index == -1) {
return "Other"
}
return PREF_SERVER_ENTRIES[index]
}
private fun getTypeName(value: String): String {
val index = PREF_TYPE_ENTRY_VALUES.indexOf(value)
if (index == -1) {
return "Other"
}
return PREF_TYPE_ENTRIES[index]
}