Skip to content

Commit

Permalink
PM-15976 πŸ’ prevent app crash for non english language (#4485)
Browse files Browse the repository at this point in the history
Co-authored-by: Phil Cappelli <[email protected]>
  • Loading branch information
dseverns-livefront and phil-livefront authored Dec 17, 2024
1 parent 596039a commit 040bf04
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ fun createClickableAnnotatedString(
mainString.lastIndexOf(text, ignoreCase = true)
}
}

// Skip adding the link if the text to highlight is not found in the main string.
// This can happen if the highlighted text is correctly translated, but the main string
// is not yet translated, causing the startIndex to be -1.
if (startIndex < 0) continue

val endIndex = startIndex + highlight.textToHighlight.length
val link = LinkAnnotation.Clickable(
tag = highlight.textToHighlight,
Expand Down

0 comments on commit 040bf04

Please sign in to comment.