From b5e04cb070b597ac848ed5222bf814db8a506726 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Tue, 7 Jul 2020 17:16:01 +0430 Subject: [PATCH] Shell: Skip creating a Join node when nothing was parsed This fixes a crash when Shell tries to highlight `|`. --- Shell/Parser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Shell/Parser.cpp b/Shell/Parser.cpp index 70357de1323..d7e038261a4 100644 --- a/Shell/Parser.cpp +++ b/Shell/Parser.cpp @@ -123,7 +123,10 @@ RefPtr Parser::parse() // Parsing stopped midway, this is a syntax error. auto error_start = push_start(); m_offset = m_input.length(); - return create(move(toplevel), create("Unexpected tokens past the end")); + auto syntax_error_node = create("Unexpected tokens past the end"); + if (toplevel) + return create(move(toplevel), move(syntax_error_node)); + return syntax_error_node; } return toplevel;