From 0388f9d9be8420affc92344adfcae04de572a9e1 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sat, 3 Aug 2024 09:40:28 -0300 Subject: [PATCH] fix(toggle-expanded): fix crash when headers happen to be empty --- .../joinmastodon/android/fragments/BaseStatusListFragment.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java index 191c2ebd8e..4814fa126f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java @@ -815,6 +815,8 @@ public void onToggleExpanded(Status status, boolean isForQuote, String itemID) { adapter.notifyItemChanged(text.getAbsoluteAdapterPosition()); } List headers=findAllHoldersOfType(itemID, HeaderStatusDisplayItem.Holder.class); + if (headers.isEmpty()) + return; HeaderStatusDisplayItem.Holder header=headers.size() > 1 && isForQuote ? headers.get(1) : headers.get(0); if(header!=null) header.animateExpandToggle(); else notifyItemChanged(itemID, HeaderStatusDisplayItem.class);