diff --git a/src/node/ext/channel_credentials.cc b/src/node/ext/channel_credentials.cc index 07763bd301d..3d47ff293df 100644 --- a/src/node/ext/channel_credentials.cc +++ b/src/node/ext/channel_credentials.cc @@ -181,6 +181,10 @@ NAN_METHOD(ChannelCredentials::Compose) { } ChannelCredentials *self = ObjectWrap::Unwrap( info.This()); + if (self->wrapped_credentials == NULL) { + return Nan::ThrowTypeError( + "Cannot compose insecure credential"); + } CallCredentials *other = ObjectWrap::Unwrap( Nan::To(info[0]).ToLocalChecked()); grpc_credentials *creds = grpc_composite_credentials_create(