Add type assertion on createSsl's fourth argument.

This commit is contained in:
Ian Haken 2018-06-20 15:01:57 -07:00
parent 637f961706
commit 15c82e08c8
1 changed files with 5 additions and 1 deletions

View File

@ -189,7 +189,11 @@ NAN_METHOD(ChannelCredentials::CreateSsl) {
}
verify_peer_options verify_options = {NULL, NULL, NULL};
if (info.Length() >= 4 && info[3]->IsObject()) {
if (!info[3]->IsUndefined()) {
if (!info[3]->IsObject()) {
return Nan::ThrowTypeError("createSsl's fourth argument must be an "
"object");
}
Local<Context> context = Nan::New<Context>();
Local<Object> object = info[3]->ToObject();
MaybeLocal<Array> maybe_props = object->GetOwnPropertyNames(context);