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
Notes:
sideshowbarker
2024-07-17 11:34:34 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/01910bca39 Pull-request: https://github.com/SerenityOS/serenity/pull/19824
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue