Fix index out of bounds

Stephen Paul Weber created

Well... "fix" if it's a race condition or something. Otherwise not sure
why it's happening.

Change summary

src/main/java/eu/siacs/conversations/entities/Conversation.java | 1 +
1 file changed, 1 insertion(+)

Detailed changes

src/main/java/eu/siacs/conversations/entities/Conversation.java 🔗

@@ -1694,6 +1694,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
                 return page2;
             }
 
+            if (position-2 > sessions.size()) return null;
             ConversationPage session = sessions.get(position-2);
             View v = session.inflateUi(container.getContext(), (s) -> removeSession(s));
             if (v != null && v.getParent() != null) {