Do not crash if we try to access an item outside of the bounds of the conversation.

This commit is contained in:
Alex Hart 2021-06-28 18:58:56 -03:00 committed by Greyson Parrelli
parent d4a3b442f4
commit 44119b6437

View file

@ -387,7 +387,13 @@ public class ConversationAdapter
if (pagingController != null) {
pagingController.onDataNeededAroundIndex(correctedPosition);
}
return super.getItem(correctedPosition);
if (correctedPosition < getItemCount()) {
return super.getItem(correctedPosition);
} else {
Log.d(TAG, "Could not access corrected position " + correctedPosition + " as it is out of bounds.");
return null;
}
}
}