Fix nullptr crash

pull/501/head
Craig Tiller 10 years ago
parent 0220cf14b0
commit db73e90e3b
  1. 4
      src/cpp/client/client_unary_call.cc

@ -64,8 +64,10 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method,
class ClientAsyncRequest final : public CallOpBuffer {
public:
bool got_message = false;
void FinalizeResult(void** tag, bool* status) override {
CallOpBuffer::FinalizeResult(tag, status);
*status &= got_message;
delete this;
}
};
@ -81,7 +83,7 @@ void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method,
buf->AddSendInitialMetadata(context);
buf->AddSendMessage(request);
buf->AddRecvInitialMetadata(&context->recv_initial_metadata_);
buf->AddRecvMessage(result, nullptr);
buf->AddRecvMessage(result, &buf->got_message);
buf->AddClientSendClose();
buf->AddClientRecvStatus(&context->trailing_metadata_, status);
call.PerformOps(buf);

Loading…
Cancel
Save