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

Loading…
Cancel
Save