Skip to content

Commit fad3a11

Browse files
committed
fix hermes build
1 parent ebfb3c3 commit fad3a11

File tree

1 file changed

+9
-3
lines changed
  • test-app/runtime/src/main/cpp/napi/hermes

1 file changed

+9
-3
lines changed

test-app/runtime/src/main/cpp/napi/hermes/jsr.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,22 @@ class JSR {
2828

2929
class NapiScope {
3030
public:
31-
explicit NapiScope(napi_env env)
31+
explicit NapiScope(napi_env env, bool openHandle = true)
3232
: env_(env)
3333
{
3434
js_lock_env(env_);
35-
napi_open_handle_scope(env_, &napiHandleScope_);
35+
if (openHandle) {
36+
napi_open_handle_scope(env_, &napiHandleScope_);
37+
} else {
38+
napiHandleScope_ = nullptr;
39+
}
3640
}
3741

3842
~NapiScope() {
3943
js_unlock_env(env_);
40-
napi_close_handle_scope(env_, napiHandleScope_);
44+
if (napiHandleScope_) {
45+
napi_close_handle_scope(env_, napiHandleScope_);
46+
}
4147
}
4248

4349
private:

0 commit comments

Comments
 (0)