From 6f1ba0af76fae26912988750765562a328bd84ea Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Fri, 11 Dec 2020 16:16:46 -0500 Subject: [PATCH] ARROW-10960: [C++] [Flight] Default to empty buffer instead of null --- cpp/src/arrow/flight/serialization_internal.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/flight/serialization_internal.cc b/cpp/src/arrow/flight/serialization_internal.cc index fb890d926d2..cf5f4140c37 100644 --- a/cpp/src/arrow/flight/serialization_internal.cc +++ b/cpp/src/arrow/flight/serialization_internal.cc @@ -374,7 +374,13 @@ grpc::Status FlightDataDeserialize(ByteBuffer* buffer, FlightData* out) { buffer->Clear(); // TODO(wesm): Where and when should we verify that the FlightData is not - // malformed or missing components? + // malformed? + + // Set the default value for an unspecified FlightData body. The other + // fields can be null if they're unspecified. + if (out->body == nullptr) { + out->body = std::make_shared(nullptr, 0); + } return grpc::Status::OK; }