Browse Source

fix possible and rare index out of bounds

pull/34/head
Jannik 1 year ago
parent
commit
09191f6732
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 3
      app/src/main/java/org/mosad/teapod/util/adapter/EpisodeItemAdapter.kt

3
app/src/main/java/org/mosad/teapod/util/adapter/EpisodeItemAdapter.kt

@ -55,7 +55,8 @@ class EpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Ada
}
fun updateWatchedState(watched: Boolean, position: Int) {
episodes[position].watched = watched
// use getOrNull as there could be a index out of bound when running this in onResume()
episodes.getOrNull(position)?.watched = watched
}
inner class EpisodeViewHolder(val binding: ItemEpisodeBinding) : RecyclerView.ViewHolder(binding.root) {

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close