diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationAdapter.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationAdapter.java index 1662978b1f..3de00d869d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationAdapter.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationAdapter.java @@ -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; + } } }