diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/TextSpec.java b/litho-widget/src/main/java/com/facebook/litho/widget/TextSpec.java index 66da765f3ab..2c9e2b99a32 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/TextSpec.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/TextSpec.java @@ -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;