diff options
Diffstat (limited to 'src/mongo/base/data_builder.h')
-rw-r--r-- | src/mongo/base/data_builder.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/base/data_builder.h b/src/mongo/base/data_builder.h index 92a0ba73d0a..aa7cb29154b 100644 --- a/src/mongo/base/data_builder.h +++ b/src/mongo/base/data_builder.h @@ -78,9 +78,12 @@ public: } DataBuilder& operator=(DataBuilder&& other) { + size_t size = other.size(); _buf = std::move(other._buf); _capacity = other._capacity; - _unwrittenSpaceCursor = {_buf.get(), _buf.get() + other.size()}; + char* start = _buf.get() + size; + char* end = _buf.get() + _capacity; + _unwrittenSpaceCursor = {start, end}; other._capacity = 0; other._unwrittenSpaceCursor = {nullptr, nullptr}; |