LibMarkdown: Fix crash when rendering unfinished link

This commit fixes a crash where the Markdown preview attempts to render
`[](`, i.e. an unfinished link. This can happen when using TextEditor
with Markdown preview mode enabled.

Co-authored-by: Liz Cody <[email protected]>
This commit is contained in:
Mark DainandLiz Cody authored and Nico Weber committed 2025-06-21 18:12:00 -04:00
1 parent a8f0837168
commit cde17a5de8
1 file changed
+2 -1
+2 -1
View File
@@ -668,7 +668,8 @@ NonnullOwnPtr<Text::Node> Text::parse_link(Vector<Token>::ConstIterator& tokens)
StringBuilder address;
bool is_escaped = *(tokens + 1) == "<"sv;
auto next = tokens + 1;
bool is_escaped = !next.is_end() && *next == "<"sv;
// Don't add the angle bracket to the address.
if (is_escaped)
tokens++;