mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
Shell: Skip creating a Join node when nothing was parsed
This fixes a crash when Shell tries to highlight `|`.
This commit is contained in:
parent
d86dbfe9e8
commit
b5e04cb070
Notes:
sideshowbarker
2024-07-19 05:02:38 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/b5e04cb070b Pull-request: https://github.com/SerenityOS/serenity/pull/2728
1 changed files with 4 additions and 1 deletions
|
@ -123,7 +123,10 @@ RefPtr<AST::Node> Parser::parse()
|
|||
// Parsing stopped midway, this is a syntax error.
|
||||
auto error_start = push_start();
|
||||
m_offset = m_input.length();
|
||||
return create<AST::Join>(move(toplevel), create<AST::SyntaxError>("Unexpected tokens past the end"));
|
||||
auto syntax_error_node = create<AST::SyntaxError>("Unexpected tokens past the end");
|
||||
if (toplevel)
|
||||
return create<AST::Join>(move(toplevel), move(syntax_error_node));
|
||||
return syntax_error_node;
|
||||
}
|
||||
|
||||
return toplevel;
|
||||
|
|
Loading…
Add table
Reference in a new issue