forked from upstream-mirrors/quik
Fix crash when ViewHolder's adapterPosition is -1
This should address #1340
This commit is contained in:
+2
-2
@@ -42,14 +42,14 @@ class ConversationMediaAdapter @Inject constructor(
|
||||
val view = inflater.inflate(R.layout.conversation_media_list_item, parent, false)
|
||||
return QkViewHolder(view).apply {
|
||||
view.thumbnail.setOnClickListener {
|
||||
val part = getItem(adapterPosition)!!
|
||||
val part = getItem(adapterPosition) ?: return@setOnClickListener
|
||||
navigator.showMedia(part.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||
val part = getItem(position)!!
|
||||
val part = getItem(position) ?: return
|
||||
val view = holder.containerView
|
||||
|
||||
GlideApp.with(context)
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ class ConversationRecipientAdapter @Inject constructor(
|
||||
val view = layoutInflater.inflate(R.layout.conversation_recipient_list_item, parent, false)
|
||||
return QkViewHolder(view).apply {
|
||||
view.setOnClickListener {
|
||||
val recipient = getItem(adapterPosition)!!
|
||||
val recipient = getItem(adapterPosition) ?: return@setOnClickListener
|
||||
if (recipient.contact == null) {
|
||||
navigator.addContact(recipient.address)
|
||||
} else {
|
||||
@@ -55,7 +55,7 @@ class ConversationRecipientAdapter @Inject constructor(
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||
val recipient = getItem(position)!!
|
||||
val recipient = getItem(position) ?: return
|
||||
val view = holder.containerView
|
||||
|
||||
view.avatar.threadId = threadId
|
||||
|
||||
Reference in New Issue
Block a user