diff options
author | murgatroid99 <mlumish@google.com> | 2015-09-28 16:31:16 -0700 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2015-09-28 16:31:16 -0700 |
commit | 9c43b00217cd22b4368804d199c3de1d4a061513 (patch) | |
tree | da88e7edcbf9516cc1a2e268b4dbdecd00319e09 /src/node/ext/call.cc | |
parent | 1abffa61f8f53cf8d2903f17671f5af75de98f70 (diff) |
Fixed some issues with new credential code
Diffstat (limited to 'src/node/ext/call.cc')
-rw-r--r-- | src/node/ext/call.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index e2a0bafe50..fccb30f547 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -729,13 +729,17 @@ NAN_METHOD(Call::GetPeer) { NAN_METHOD(Call::SetCredentials) { Nan::HandleScope scope; + if (!HasInstance(info.This())) { + return Nan::ThrowTypeError( + "setCredentials can only be called on Call objects"); + } if (!Credentials::HasInstance(info[0])) { return Nan::ThrowTypeError( "setCredentials' first argument must be a credential"); } Call *call = ObjectWrap::Unwrap<Call>(info.This()); Credentials *creds_object = ObjectWrap::Unwrap<Credentials>( - Nan::To<Object>(info[1]).ToLocalChecked()); + Nan::To<Object>(info[0]).ToLocalChecked()); grpc_credentials *creds = creds_object->GetWrappedCredentials(); grpc_call_error error = GRPC_CALL_ERROR; if (creds) { |