From 9437aaad26370065327efaa1b6a28e4b310ce256 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 3 Nov 2018 10:41:10 -0400 Subject: [PATCH] src: fix Get() usage in async_wrap.cc PR-URL: https://github.com/nodejs/node/pull/24060 Reviewed-By: Daniel Bevenius Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung --- src/async_wrap.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 021bfbdf54c48e..d23e59f69e721c 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -359,8 +359,13 @@ void AsyncWrap::WeakCallback(const v8::WeakCallbackInfo& info) { std::unique_ptr p{info.GetParameter()}; Local prop_bag = PersistentToLocal(info.GetIsolate(), p->propBag); + Local val; + + if (!prop_bag->Get(p->env->context(), p->env->destroyed_string()) + .ToLocal(&val)) { + return; + } - Local val = prop_bag->Get(p->env->destroyed_string()); if (val->IsFalse()) { AsyncWrap::EmitDestroy(p->env, p->asyncId); }