Fix crash in hasHeader via range check.

This commit is contained in:
Alex Hart
2023-07-18 13:44:51 -03:00
committed by Nicholas
parent 8fcdd7cb8a
commit b8effba497

View File

@@ -93,7 +93,11 @@ class ConversationItemDecorations(hasWallpaper: Boolean = false, private val sch
}
private fun hasHeader(position: Int): Boolean {
val model = currentItems[position]
val model = if (position in currentItems.indices) {
currentItems[position]
} else {
null
}
if (model == null || model !is ConversationMessageElement) {
return false