mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
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:
1 parent
a8f0837168
commit
cde17a5de8
1 file changed
+2
-1
@@ -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++;
|
||||
|
||||
Reference in new issue
Block a user