summaryrefslogtreecommitdiff
path: root/cli/napi
diff options
context:
space:
mode:
Diffstat (limited to 'cli/napi')
-rw-r--r--cli/napi/js_native_api.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/napi/js_native_api.rs b/cli/napi/js_native_api.rs
index 62ac40159..aefe8dd0d 100644
--- a/cli/napi/js_native_api.rs
+++ b/cli/napi/js_native_api.rs
@@ -1718,12 +1718,12 @@ fn napi_get_element(
#[napi_sym::napi_sym]
fn napi_get_global(env: *mut Env, result: *mut napi_value) -> Result {
check_env!(env);
- let env = unsafe { &mut *env };
+ check_arg!(env, result);
- let context = &mut env.scope().get_current_context();
- let global = context.global(&mut env.scope());
- let value: v8::Local<v8::Value> = global.into();
+ let value: v8::Local<v8::Value> =
+ transmute::<NonNull<v8::Value>, v8::Local<v8::Value>>((*env).global);
*result = value.into();
+ napi_clear_last_error(env);
Ok(())
}