Skip to content

Commit

Permalink
Do not crash if we try to access an item outside of the bounds of the…
Browse files Browse the repository at this point in the history
… conversation.
  • Loading branch information
alex-signal authored and greyson-signal committed Jun 28, 2021
1 parent d4a3b44 commit 44119b6
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,13 @@ public void onBindHeaderViewHolder(StickyHeaderViewHolder viewHolder, int positi
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;
}
}
}

Expand Down

0 comments on commit 44119b6

Please sign in to comment.