Skip to content

Commit d405a0d

Browse files
PM-15976 - App crashes when non-english language user tries to create account (#4460)
1 parent 8658725 commit d405a0d

File tree

1 file changed

+6
-0
lines changed
  • app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util

1 file changed

+6
-0
lines changed

app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/Text.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ fun createClickableAnnotatedString(
199199
mainString.lastIndexOf(text, ignoreCase = true)
200200
}
201201
}
202+
203+
// Skip adding the link if the text to highlight is not found in the main string.
204+
// This can happen if the highlighted text is correctly translated, but the main string
205+
// is not yet translated, causing the startIndex to be -1.
206+
if (startIndex < 0) continue
207+
202208
val endIndex = startIndex + highlight.textToHighlight.length
203209
val link = LinkAnnotation.Clickable(
204210
tag = highlight.textToHighlight,

0 commit comments

Comments
 (0)