File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ inline std::size_t size_for_int(std::size_t arg) {
442442 ++r;
443443 arg /= 10 ;
444444 }
445- return r;
445+ return std::max< size_t >( 1 , r); /* if r == 0 we clamp max to 1 to allow minimum containing "0" as char */
446446}
447447
448448inline std::size_t command_size (const single_command_t &cmd) {
@@ -477,9 +477,11 @@ inline void Protocol::serialize(DynamicBuffer &buff,
477477 it += bytes;
478478 total += bytes;
479479
480- buffer_copy (it, buffer (arg.data (), arg.size ()));
481- it += arg.size ();
482- total += arg.size ();
480+ if (!arg.empty ()) {
481+ buffer_copy (it, buffer (arg.data (), arg.size ()));
482+ it += arg.size ();
483+ total += arg.size ();
484+ }
483485
484486 buffer_copy (it, buffer (" \r\n " , terminator.size ));
485487 total += terminator.size ;
You can’t perform that action at this time.
0 commit comments