diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/atoms/text/BoundCounter.kt b/core/ui/src/main/java/com/tangem/core/ui/components/atoms/text/BoundCounter.kt index 6a97038b3d..7bda686f02 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/atoms/text/BoundCounter.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/atoms/text/BoundCounter.kt @@ -31,7 +31,9 @@ internal class BoundCounter( } fun addNextChar() { - string += text[charPosition(string.count())] + val nextIndex = charPosition(string.count()) + if (nextIndex < 0 || nextIndex >= text.length) return + string += text[nextIndex] width += nextCharWidth() _nextCharWidth = null }