Skip to content

Commit

Permalink
RoomsAdapter$onCreateViewHolder$1.onClick 异常
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenhhe authored and archurcode committed May 19, 2021
1 parent cf5fabc commit 449dc27
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class RoomsAdapter(list: MutableList<RoomEntity>) : RecyclerView.Adapter<RoomsAd
val holder = ViewHolder(view)
view.setOnClickListener {
val position = holder.adapterPosition
if (onItemClicked != null) {
if (onItemClicked != null &&
position < list.size && position >= 0) {
onItemClicked!!.onItemClicked(position, list[position])
}
}
Expand Down

0 comments on commit 449dc27

Please sign in to comment.