fixed IndexOutOfBounds when rendering quotes
This commit is contained in:
parent
226eb739bd
commit
ba4a47204b
|
@ -370,9 +370,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||
char current = body.length() > i ? body.charAt(i) : '\n';
|
||||
if (lineStart == -1) {
|
||||
if (previous == '\n') {
|
||||
if (
|
||||
QuoteHelper.isPositionQuoteStart(body, i)
|
||||
) {
|
||||
if (i < body.length() && QuoteHelper.isPositionQuoteStart(body, i)) {
|
||||
// Line start with quote
|
||||
lineStart = i;
|
||||
if (quoteStart == -1) quoteStart = i;
|
||||
|
|
|
@ -38,13 +38,13 @@ public class QuoteHelper {
|
|||
}
|
||||
|
||||
// 'Prequote' means anything we require or can accept in front of a QuoteChar
|
||||
public static boolean isPositionPrecededByPrequote(CharSequence body, int pos){
|
||||
public static boolean isPositionPrecededByPreQuote(CharSequence body, int pos) {
|
||||
return UIHelper.isPositionPrecededByLineStart(body, pos);
|
||||
}
|
||||
|
||||
public static boolean isPositionQuoteStart(CharSequence body, int pos) {
|
||||
return (isPositionQuoteCharacter(body, pos)
|
||||
&& isPositionPrecededByPrequote(body, pos)
|
||||
&& isPositionPrecededByPreQuote(body, pos)
|
||||
&& (UIHelper.isPositionFollowedByQuoteableCharacter(body, pos)
|
||||
|| isPositionFollowedByQuoteChar(body, pos)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue