From dc2d4b62e6cd998711ab9581bd2b0aadfbcea07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Zag=C3=B3rski?= Date: Thu, 7 Nov 2024 17:01:24 +0100 Subject: [PATCH] fix: Username index out of bounds exception #WPB-12143 (#3605) --- .../android/ui/common/textfield/InputTransformations.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/common/textfield/InputTransformations.kt b/app/src/main/kotlin/com/wire/android/ui/common/textfield/InputTransformations.kt index 08c1e02c4d..e6c31c049c 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/textfield/InputTransformations.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/textfield/InputTransformations.kt @@ -90,7 +90,11 @@ fun InputTransformation.forceLowercase(): InputTransformation = class ForceLowercaseTransformation : InputTransformation { override fun TextFieldBuffer.transformInput() { - replace(0, length, asCharSequence().toString().lowercase()) + val currentText = asCharSequence().toString() + val lowercasedText = currentText.lowercase() + if (currentText != lowercasedText) { + replace(0, length, lowercasedText) + } } }