Fix crash when emitting unhandled error on native EventEmitter

This commit is contained in:
Samuel Attard 2017-11-13 03:00:16 +11:00
parent 40b94e97e5
commit aa6b9a5025

View file

@ -20,8 +20,12 @@ v8::Local<v8::Value> CallMethodWithArgs(v8::Isolate* isolate,
v8::MicrotasksScope::kRunMicrotasks);
// Use node::MakeCallback to call the callback, and it will also run pending
// tasks in Node.js.
return node::MakeCallback(isolate, obj, method, args->size(), &args->front(),
{0, 0}).ToLocalChecked();
v8::MaybeLocal<v8::Value> ret = node::MakeCallback(isolate, obj, method, args->size(), &args->front(),
{0, 0});
if (ret.IsEmpty()) {
return v8::Boolean::New(isolate, false);
}
return ret.ToLocalChecked();
}
} // namespace internal