Prevent crash when trying to save conversation viewing position.

This commit is contained in:
Cody Henthorne 2021-03-24 19:55:43 -04:00 committed by Alex Hart
parent b65d9ffaed
commit 815a988587

View file

@ -595,7 +595,12 @@ public class ConversationAdapter
}
public @Nullable ConversationMessage getLastVisibleConversationMessage(int position) {
return getItem(position - ((hasFooter() && position == getItemCount() - 1) ? 1 : 0));
try {
return getItem(position - ((hasFooter() && position == getItemCount() - 1) ? 1 : 0));
} catch (IndexOutOfBoundsException e) {
Log.w(TAG, "Race condition changed size of conversation", e);
return null;
}
}
public void setMessageRequestAccepted(boolean messageRequestAccepted) {