mirror of
https://github.com/RGBCube/serenity
synced 2025-07-22 11:17:35 +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:
parent
ae3a7fd4b8
commit
01910bca39
1 changed files with 2 additions and 1 deletions
|
@ -4988,7 +4988,8 @@ template NonnullRefPtr<FunctionDeclaration> Parser::parse_function_node(u16, Opt
|
||||||
NonnullRefPtr<Identifier const> Parser::create_identifier_and_register_in_current_scope(SourceRange range, DeprecatedFlyString string)
|
NonnullRefPtr<Identifier const> Parser::create_identifier_and_register_in_current_scope(SourceRange range, DeprecatedFlyString string)
|
||||||
{
|
{
|
||||||
auto id = create_ast_node<Identifier const>(range, string);
|
auto id = create_ast_node<Identifier const>(range, string);
|
||||||
m_state.current_scope_pusher->register_identifier(const_cast<Identifier&>(*id));
|
if (m_state.current_scope_pusher)
|
||||||
|
m_state.current_scope_pusher->register_identifier(const_cast<Identifier&>(*id));
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue