aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/util/byte_buffer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpp/util/byte_buffer.cc')
-rw-r--r--src/cpp/util/byte_buffer.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc
index 2952f94b24..b9302d3cdc 100644
--- a/src/cpp/util/byte_buffer.cc
+++ b/src/cpp/util/byte_buffer.cc
@@ -85,7 +85,9 @@ ByteBuffer::ByteBuffer(const ByteBuffer& buf)
ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) {
Clear(); // first remove existing data
- buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy
+ if (buf.buffer_) {
+ buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy
+ }
return *this;
}