module: add missing return in ImportMetaResolveLazyGetter

When the creation context of the import.meta object has no associated
Realm, the getter threw ERR_INVALID_INVOCATION but then fell through
and dereferenced the null Realm. Return after throwing, as the other
error paths in the getter already do.

Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67496
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
James M Snell committed 2026-11-27 16:26:41 -08:00
1 parent 99e188b3db
commit 117744381b
1 file changed
+1
+1
View File
@@ -1261,6 +1261,7 @@ static void ImportMetaResolveLazyGetter(
Realm* realm = Realm::GetCurrent(context);
if (realm == nullptr) {
THROW_ERR_INVALID_INVOCATION(isolate);
return;
}
Local<Function> initializer = realm->host_import_meta_resolve_initializer();
if (initializer.IsEmpty()) {