Skip to content

Commit

Permalink
fix crash at status details adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlaster committed Mar 1, 2021
1 parent 9d9a98d commit afac44c
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,26 +124,25 @@ class StatusDetailsAdapter(
}

override fun getStatus(position: Int, raw: Boolean): ParcelableStatus {
data?.let { data ->
when (getItemCountIndex(position, raw)) {
ITEM_IDX_CONVERSATION -> {
when (getItemCountIndex(position, raw)) {
ITEM_IDX_CONVERSATION -> {
data?.let { data ->
var idx = position - getIndexStart(ITEM_IDX_CONVERSATION)
if (data.getOrNull(idx)?.is_filtered == true) idx++
if (data[idx].is_filtered) idx++
return data[idx]
}
ITEM_IDX_REPLY -> {
}
ITEM_IDX_REPLY -> {
data?.let { data ->
var idx = position - getIndexStart(ITEM_IDX_CONVERSATION) -
getTypeCount(ITEM_IDX_CONVERSATION) - getTypeCount(ITEM_IDX_STATUS) +
replyStart
if (data.getOrNull(idx)?.is_filtered == true) idx++
if (data[idx].is_filtered) idx++
return data[idx]
}
ITEM_IDX_STATUS -> {
return status!!
}
else -> {

}
}
ITEM_IDX_STATUS -> {
return status!!
}
}
throw IndexOutOfBoundsException("index: $position")
Expand Down

0 comments on commit afac44c

Please sign in to comment.