1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 02:57:40 +00:00

LibJS: Null check current scope pusher before register_identifier call

This fixes crashing when current scope pusher is null during identifier
parsing.
This commit is contained in:
Aliaksandr Kalenik 2023-07-05 21:15:36 +02:00 committed by Andreas Kling
parent ae3a7fd4b8
commit 01910bca39

View file

@ -4988,6 +4988,7 @@ template NonnullRefPtr<FunctionDeclaration> Parser::parse_function_node(u16, Opt
NonnullRefPtr<Identifier const> Parser::create_identifier_and_register_in_current_scope(SourceRange range, DeprecatedFlyString string)
{
auto id = create_ast_node<Identifier const>(range, string);
if (m_state.current_scope_pusher)
m_state.current_scope_pusher->register_identifier(const_cast<Identifier&>(*id));
return id;
}