From 07c7f5bc086de3f99396a773371e76cbbb2901e0 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 17 Sep 2015 14:02:28 +0200 Subject: catch IndexOutOfBoundsException when swiping away conversations --- src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 913190b4..48045a64 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -210,7 +210,11 @@ public class ConversationActivity extends XmppActivity View v = listView.getChildAt(0); final int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop()); - swipedConversation = listAdapter.getItem(position); + try { + swipedConversation = listAdapter.getItem(position); + } catch (IndexOutOfBoundsException e) { + return null; + } listAdapter.remove(swipedConversation); swipedConversation.markRead(); xmppConnectionService.getNotificationService().clear(swipedConversation); -- cgit v1.2.3