diff options
author | gengjiawen <technicalcute@gmail.com> | 2020-03-04 16:36:46 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2020-03-24 09:55:02 +0300 |
commit | d497f268f2129e1bb33db5d1e6464deacf01b745 (patch) | |
tree | 5ea102c80267c5e8156d2ba48a75c96578553f82 /src/module_wrap.cc | |
parent | 2262e7c26de28b54b943c68f970f3e1c3b62d88c (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( |