Skip to content

Commit

Permalink
Fixes StringIndexOutOfBoundsException caused by ellipsis offset.
Browse files Browse the repository at this point in the history
Summary: Fixes StringIndexOutOfBoundsException caused by ellipsis offset. Overrides the offset if it is greater than the length of the text.

Reviewed By: astreet

Differential Revision: D23756985

fbshipit-source-id: 11f6ef5314a4349e2cb5aa74937b546104e8e938
  • Loading branch information
adityasharat authored and facebook-github-bot committed Sep 18, 2020
1 parent b22f029 commit e22f6c5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,11 @@ private static CharSequence truncateText(
ellipsisOffset = ellipsisStart;
}
}
if (ellipsisOffset < 0) {
ellipsisOffset = 0;
} else if (ellipsisOffset > text.length()) {
ellipsisOffset = text.length();
}
return TextUtils.concat(text.subSequence(0, ellipsisOffset), customEllipsisText);
} else {
return text;
Expand Down

0 comments on commit e22f6c5

Please sign in to comment.