diff options
Diffstat (limited to 'src/cpp/util/byte_buffer.cc')
-rw-r--r-- | src/cpp/util/byte_buffer.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc index c0a14de418..c2cd20ee07 100644 --- a/src/cpp/util/byte_buffer.cc +++ b/src/cpp/util/byte_buffer.cc @@ -58,18 +58,22 @@ void ByteBuffer::Clear() { } } -void ByteBuffer::Dump(std::vector<Slice>* slices) const { +Status ByteBuffer::Dump(std::vector<Slice>* slices) const { slices->clear(); if (!buffer_) { - return; + return Status(StatusCode::FAILED_PRECONDITION, "Buffer not initialized"); } grpc_byte_buffer_reader reader; - grpc_byte_buffer_reader_init(&reader, buffer_); + if (!grpc_byte_buffer_reader_init(&reader, buffer_)) { + return Status(StatusCode::INTERNAL, + "Couldn't initialize byte buffer reader"); + } gpr_slice s; while (grpc_byte_buffer_reader_next(&reader, &s)) { slices->push_back(Slice(s, Slice::STEAL_REF)); } grpc_byte_buffer_reader_destroy(&reader); + return Status::OK; } size_t ByteBuffer::Length() const { |