0

I want a summary model to be the sticky header so I added the following check.

override fun isStickyHeader(position: Int): Boolean {
    val model = adapter.getModelAtPosition(position)
    return (model is RoleHeader) || (model is StaffHeader)
}

I noticed that after the state of this view changed, under some circumstances the view would crash. Through debugging I found that the position that passed into this function was larger than the count of the models

So i used try/catch to fix it but that broke my view:

override fun isStickyHeader(position: Int): Boolean {
    return try {
        val model = adapter.getModelAtPosition(position)
        (model is RoleHeader) || (model is StaffHeader)
    } catch (e: Exception) {
        false
    }
}

I wish someone could fix that?

NDC00
  • 11
  • 2
  • I fixed this error. If you also encounter this error, you can refer to it: https://github.com/airbnb/epoxy/issues/1211 – NDC00 Nov 30 '22 at 07:21

0 Answers0