Skip to content

Commit 28bae01

Browse files
committed
buffer: allow to read zero bytes
Decoder can try to read zero bytes sometimes. For example, when it received an empty string. Let's simply handle this case in buffer instead of assertion. By the way, `ClientTest.cpp` was failing with Tarantool 3.2 because of this problem: when connector tries to call a non-existing function (`*** TEST CASE call wrong function ***`), Tarantool sends an empty string in response.
1 parent f15e8e9 commit 28bae01

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Buffer/Buffer.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,8 @@ template <bool LIGHT>
12381238
void
12391239
Buffer<N, allocator>::iterator_common<LIGHT>::read(RData data)
12401240
{
1241-
assert(data.size > 0);
1241+
if (data.size == 0)
1242+
return;
12421243
/*
12431244
* The same implementation as in ::set() method buf vice versa:
12441245
* buffer and data sources are swapped.

0 commit comments

Comments
 (0)