Use the adapter position when responding to clicks on followed tags (#3334)

This ensures that the position is valid w.r.t. to the backing array.

Fixes https://github.com/tuskyapp/Tusky/issues/3333
This commit is contained in:
Nik Clayton 2023-02-20 20:36:37 +01:00 committed by GitHub
parent 8f3869d42e
commit 2974265c4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,7 @@ class FollowedTagsAdapter(
viewModel.tags[position].let { tag -> viewModel.tags[position].let { tag ->
holder.itemView.findViewById<TextView>(R.id.followed_tag).text = tag.name holder.itemView.findViewById<TextView>(R.id.followed_tag).text = tag.name
holder.itemView.findViewById<ImageButton>(R.id.followed_tag_unfollow).setOnClickListener { holder.itemView.findViewById<ImageButton>(R.id.followed_tag_unfollow).setOnClickListener {
actionListener.unfollow(tag.name, position) actionListener.unfollow(tag.name, holder.bindingAdapterPosition)
} }
} }
} }