From fc3ba1b6e2757a1d2dc48a4418e74dee0c5db034 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 2 Nov 2024 20:56:58 -0500 Subject: [PATCH] index bounds guard Shouldn't be needed... but just in case, better than a crash (cherry picked from commit 3014b2e034e964681190d6997b23395b9af1ddfa) --- .../java/eu/siacs/conversations/ui/ConversationsActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index 25d75b7c5..0ebdcdb4c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -339,7 +339,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio } } - items.subList(endOfMainFilters, endOfMainFilters + tags.size()).sort((x, y) -> x.getTag() == null ? -1 : ((Comparable) x.getTag()).compareTo(y.getTag())); + items.subList(endOfMainFilters, Math.min(endOfMainFilters + tags.size(), items.size())).sort((x, y) -> x.getTag() == null ? -1 : ((Comparable) x.getTag()).compareTo(y.getTag())); binding.drawer.getItemAdapter().getFastAdapter().notifyDataSetChanged(); return kotlin.Unit.INSTANCE; });