fix getting a buffer in case a pool is not available

This commit is contained in:
bernatx 2023-06-09 15:52:42 +02:00 committed by bernat
parent 57d785bd7c
commit 2b78e09db2
2 changed files with 8 additions and 2 deletions

View File

@ -43,7 +43,10 @@ namespace detail {
/// messages sent through the stream are big and have (approximately) the
/// same size.
Buffer MakeBuffer() {
if (_shared_state)
return _shared_state->MakeBuffer();
else
return Buffer();
}
/// Flush @a buffers down the stream. No copies are made.

View File

@ -19,7 +19,10 @@ namespace detail {
StreamStateBase::~StreamStateBase() = default;
Buffer StreamStateBase::MakeBuffer() {
if (_buffer_pool)
return _buffer_pool->Pop();
else
return Buffer();
}
} // namespace detail