diff --git a/Userland/Libraries/LibJS/Interpreter.cpp b/Userland/Libraries/LibJS/Interpreter.cpp index 04d5d64f01..f69eb15f58 100644 --- a/Userland/Libraries/LibJS/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Interpreter.cpp @@ -113,7 +113,9 @@ void Interpreter::enter_scope(const ScopeNode& scope_node, ScopeType scope_type, } HashMap scope_variables_with_declaration_kind; - scope_variables_with_declaration_kind.ensure_capacity(16); + + if (!scope_node.variables().is_empty()) + scope_variables_with_declaration_kind.ensure_capacity(16); bool is_program_node = is(scope_node);