Skip to content

Commit

Permalink
fix: map to mentions [WPB-4232] (#2142)
Browse files Browse the repository at this point in the history
Co-authored-by: Jakub Żerko <iot.zerko@gmail.com>
Co-authored-by: Yamil Medina <yamilmedina@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 29, 2023
1 parent e6128c9 commit a48cd97
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private fun mapToDisplayMentions(uiText: UIText, resources: Resources): Pair<Lis
val mentions = uiText.mentions.sortedBy { it.start }.reversed()
val mentionList = mentions.mapNotNull {
// secured crash for mentions caused by web when text without mentions contains mention data
if (it.start + it.length < uiText.value.length && uiText.value.elementAt(it.start) == '@') {
if (it.start + it.length <= uiText.value.length && uiText.value.elementAt(it.start) == '@') {
val mentionName = uiText.value.substring(it.start, it.start + it.length)
stringBuilder.insert(it.start + it.length, MENTION_MARK)
stringBuilder.insert(it.start, MENTION_MARK)
Expand Down

0 comments on commit a48cd97

Please sign in to comment.