try to catch plattform bugs

This commit is contained in:
Daniel Gultsch 2015-10-02 11:58:03 +02:00
parent 9bb8683048
commit 160dfa49a0
1 changed files with 6 additions and 1 deletions

View File

@ -274,7 +274,12 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.messageBody.setIncludeFontPadding(true); viewHolder.messageBody.setIncludeFontPadding(true);
if (message.getBody() != null) { if (message.getBody() != null) {
final String nick = UIHelper.getMessageDisplayName(message); final String nick = UIHelper.getMessageDisplayName(message);
final String body = message.getMergedBody().replaceAll("^" + Message.ME_COMMAND,nick + " "); String body;
try {
body = message.getMergedBody().replaceAll("^" + Message.ME_COMMAND, nick + " ");
} catch (ArrayIndexOutOfBoundsException e) {
body = message.getMergedBody();
}
final SpannableString formattedBody = new SpannableString(body); final SpannableString formattedBody = new SpannableString(body);
int i = body.indexOf(Message.MERGE_SEPARATOR); int i = body.indexOf(Message.MERGE_SEPARATOR);
while(i >= 0) { while(i >= 0) {