Merge pull request #956 from vector-im/feature/bma/fixAlternateTextCrash
alternateText can't be an empty string. #955
This commit is contained in:
commit
7d1663c7d0
1 changed files with 13 additions and 3 deletions
|
|
@ -544,17 +544,27 @@ private fun AnnotatedString.Builder.appendLink(link: Element) {
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomEmailInviteLink -> {
|
is PermalinkData.RoomEmailInviteLink -> {
|
||||||
appendInlineContent(CHIP_ID, link.ownText())
|
safeAppendInlineContent(CHIP_ID, link.ownText())
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
appendInlineContent(CHIP_ID, link.ownText())
|
safeAppendInlineContent(CHIP_ID, link.ownText())
|
||||||
}
|
}
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
appendInlineContent(CHIP_ID, link.ownText())
|
safeAppendInlineContent(CHIP_ID, link.ownText())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun AnnotatedString.Builder.safeAppendInlineContent(chipId: String, ownText: String) {
|
||||||
|
if (ownText.isEmpty()) {
|
||||||
|
// alternateText cannot be empty and default parameter value is private,
|
||||||
|
// so just omit the second param here.
|
||||||
|
appendInlineContent(chipId)
|
||||||
|
} else {
|
||||||
|
appendInlineContent(chipId, ownText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun HtmlText(
|
private fun HtmlText(
|
||||||
text: AnnotatedString,
|
text: AnnotatedString,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue