diff --git a/app/src/main/java/org/mosad/teapod/util/adapter/EpisodeItemAdapter.kt b/app/src/main/java/org/mosad/teapod/util/adapter/EpisodeItemAdapter.kt index 95be799..6eb467c 100644 --- a/app/src/main/java/org/mosad/teapod/util/adapter/EpisodeItemAdapter.kt +++ b/app/src/main/java/org/mosad/teapod/util/adapter/EpisodeItemAdapter.kt @@ -55,7 +55,8 @@ class EpisodeItemAdapter(private val episodes: List) : 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) {