catch IndexOutOfBoundsException when swiping away conversations

This commit is contained in:
Daniel Gultsch 2015-09-17 14:02:28 +02:00
parent 7e712d9d4c
commit 07c7f5bc08

View File

@ -210,7 +210,11 @@ public class ConversationActivity extends XmppActivity
View v = listView.getChildAt(0); View v = listView.getChildAt(0);
final int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop()); 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); listAdapter.remove(swipedConversation);
swipedConversation.markRead(); swipedConversation.markRead();
xmppConnectionService.getNotificationService().clear(swipedConversation); xmppConnectionService.getNotificationService().clear(swipedConversation);