From 4ca1a7b29ee8d569c04e25d174099dc6f0614844 Mon Sep 17 00:00:00 2001 From: sk Date: Sun, 4 Jun 2023 11:45:12 +0200 Subject: [PATCH] fix index out of bounds exception --- .../android/ui/displayitems/TextStatusDisplayItem.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java index a6d419c49..5cb152f0f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java @@ -237,9 +237,9 @@ public class TextStatusDisplayItem extends StatusDisplayItem{ spaceBelowText.setVisibility(translateVisible ? View.VISIBLE : View.GONE); // remove additional padding when (transparently padded) translate button is visible - int pos = getAbsoluteAdapterPosition(); - boolean nextIsFooter = item.parentFragment.getDisplayItems().size() >= pos + 1 && - item.parentFragment.getDisplayItems().get(pos + 1) instanceof FooterStatusDisplayItem; + int nextPos = getAbsoluteAdapterPosition(); + boolean nextIsFooter = item.parentFragment.getDisplayItems().size() > nextPos && + item.parentFragment.getDisplayItems().get(nextPos) instanceof FooterStatusDisplayItem; int bottomPadding = (translateVisible && nextIsFooter) ? 0 : nextIsFooter ? V.dp(8) : V.dp(12);