Merge pull request #1165 from MusicScience37/fix-error-for-empty-data-in-fbuffer

Fixed processing of empty data in fbuffer class.
This commit is contained in:
Takatoshi Kondo
2025-07-21 23:16:51 +09:00
committed by GitHub
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -31,6 +31,7 @@ public:
{
MSGPACK_ASSERT(buf || len == 0);
if (!buf) return;
if (len == 0) return;
if (1 != fwrite(buf, len, 1, m_file)) {
throw std::runtime_error("fwrite() failed");
}
+1
View File
@@ -90,6 +90,7 @@ BOOST_AUTO_TEST_CASE(fbuffer)
fbuf.write("a", 1);
fbuf.write("a", 1);
fbuf.write("a", 1);
fbuf.write("", 0);
fflush(file);
rewind(file);