From a29120d911c65c424afe1fb84b864304767661ea Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Mon, 4 Feb 2013 22:09:17 -0800 Subject: [PATCH] Fix for IndexOutOfBoundException (race condition on Recipients resolution) --- src/org/thoughtcrime/securesms/ConversationListItem.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ConversationListItem.java b/src/org/thoughtcrime/securesms/ConversationListItem.java index 801a201c8a..9beb9ca885 100644 --- a/src/org/thoughtcrime/securesms/ConversationListItem.java +++ b/src/org/thoughtcrime/securesms/ConversationListItem.java @@ -172,12 +172,13 @@ public class ConversationListItem extends RelativeLayout } private CharSequence formatFrom(Recipients from, long count, boolean read) { - SpannableStringBuilder builder = new SpannableStringBuilder(from.toShortString()); + String fromString = from.toShortString(); + SpannableStringBuilder builder = new SpannableStringBuilder(fromString); if (count > 0) { builder.append(" " + count); builder.setSpan(new ForegroundColorSpan(Color.parseColor("#66333333")), - from.toShortString().length(), builder.length(), + fromString.length(), builder.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE); } @@ -198,6 +199,7 @@ public class ConversationListItem extends RelativeLayout } private class CheckedChangedListener implements CompoundButton.OnCheckedChangeListener { + @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) selectedThreads.add(threadId); else selectedThreads.remove(threadId);