Skip to content

Commit 1488967

Browse files
committed
Fix std::basic_string::assign on [nullptr, nullptr) range (#166)
1 parent 3fed9bb commit 1488967

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

util/generic/buffer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ TBuffer::~TBuffer() {
9494
}
9595

9696
void TBuffer::AsString(TString& s) {
97-
s.assign(Data(), Size());
97+
Y_ASSERT(Data() != nullptr || Size() == 0);
98+
s.assign(Data() == nullptr ? "" : Data(), Size());
9899
Clear();
99100
}

0 commit comments

Comments
 (0)