From 42515bc48c1ee577f5fbb90da48ca250c0514716 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 26 Sep 2022 12:24:56 -0500 Subject: [PATCH] Fix out of bounds crash --- .../siacs/conversations/ui/ConversationsOverviewFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java index 09246d6af9c17203923cbe3d77f076b4bebb420b..239c68c68cc85a56e7ee3b48271d0bd2fbf6da3a 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java @@ -364,6 +364,9 @@ public class ConversationsOverviewFragment extends XmppFragment { @Override public boolean onContextItemSelected(MenuItem item) { + int pos = ((AdapterContextMenuInfo) item.getMenuInfo()).position; + if (conversations == null || conversations.size() < pos || pos < 0) return false; + Conversation conversation = conversations.get(((AdapterContextMenuInfo) item.getMenuInfo()).position); ConversationFragment fragment = new ConversationFragment(); fragment.setHasOptionsMenu(false);