diff options
author | gengjiawen <technicalcute@gmail.com> | 2020-03-04 16:36:46 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-03-12 18:55:53 +0300 |
commit | 6dca708699e0ab5015871cc36e60732de036326b (patch) | |
tree | a4ffdff931f90b18f8c5d2f465bc926f782a4466 /src/module_wrap.cc | |
parent | d53bcea2de4e681809ad10c580feb2ca27b3bec4 (diff) |
src: refactor to more safe method
PR-URL: https://github.com/nodejs/node/pull/32087
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/module_wrap.cc')
-rw-r--r-- | src/module_wrap.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/module_wrap.cc b/src/module_wrap.cc index b2afefce17e..b2e29df1a06 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -1460,8 +1460,8 @@ static MaybeLocal<Promise> ImportModuleDynamically( Local<PrimitiveArray> options = referrer->GetHostDefinedOptions(); if (options->Length() != HostDefinedOptions::kLength) { - Local<Promise::Resolver> resolver = - Promise::Resolver::New(context).ToLocalChecked(); + Local<Promise::Resolver> resolver; + if (!Promise::Resolver::New(context).ToLocal(&resolver)) return {}; resolver ->Reject(context, v8::Exception::TypeError(FIXED_ONE_BYTE_STRING( |