fix(ratex): prevent crash with empty ratex

This commit is contained in:
infi 2026-06-17 20:18:57 +02:00
parent 3a07d78da3
commit 0c2cd61aa1
1 changed files with 2 additions and 2 deletions

View File

@ -255,13 +255,13 @@ fun ChatMarkdown(
GFMElementTypes.INLINE_MATH -> {
val latex = child.getTextInNode(content).toString().removeSurrounding("$")
appendInlineContent("math:i:$latex", latex)
if (latex.isNotEmpty()) appendInlineContent("math:i:$latex", latex)
true
}
GFMElementTypes.BLOCK_MATH -> {
val latex = child.getTextInNode(content).toString().removeSurrounding("$$").trim()
appendInlineContent("math:b:$latex", latex)
if (latex.isNotEmpty()) appendInlineContent("math:b:$latex", latex)
true
}