File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed 
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -531,9 +531,12 @@ private void generateVarData(
531531 indent  + " %3$s lengthFieldValue = %4$s(length);\n "  +
532532 indent  + " sbePosition(lengthPosition + lengthOfLengthField);\n "  +
533533 indent  + " std::memcpy(m_buffer + lengthPosition, &lengthFieldValue, sizeof(%3$s));\n "  +
534-  indent  + " std::uint64_t pos = sbePosition();\n "  +
535-  indent  + " sbePosition(pos + length);\n "  +
536-  indent  + " std::memcpy(m_buffer + pos, src, length);\n "  +
534+  indent  + " if (length != %3$s(0))"  +
535+  indent  + " {"  +
536+  indent  + " std::uint64_t pos = sbePosition();\n "  +
537+  indent  + " sbePosition(pos + length);\n "  +
538+  indent  + " std::memcpy(m_buffer + pos, src, length);\n "  +
539+  indent  + " }"  +
537540 indent  + " return *this;\n "  +
538541 indent  + " }\n " ,
539542 propertyName ,
                         You can’t perform that action at this time. 
           
                  
0 commit comments