Fix potention OOB error when pulse-highlighting a message.

This basically happened if you used full-text search to search for the
latest message in a conversation, but when you navigated there, it
*also* had a header set (like a typing indicator or unknownSenderView).
This commit is contained in:
Greyson Parrelli 2020-05-19 17:09:25 -04:00
parent 1b2f964f32
commit a0b4065be3

View File

@ -358,8 +358,10 @@ public class ConversationAdapter<V extends View & BindableConversationItem>
*/
void pulseHighlightItem(int position) {
if (position >= 0 && position < getItemCount()) {
recordToPulseHighlight = getItem(position);
notifyItemChanged(position);
int correctedPosition = isHeaderPosition(position) ? position + 1 : position;
recordToPulseHighlight = getItem(correctedPosition);
notifyItemChanged(correctedPosition);
}
}