Skip to content

Commit

Permalink
fix #1266
Browse files Browse the repository at this point in the history
  • Loading branch information
Reputeless committed Oct 2, 2024
1 parent 27a88e6 commit 360cd39
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Siv3D/src/Siv3D/MemoryWriter/SivMemoryWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace s3d
return 0;
}

if (sizeBytes == 0)
if (sizeBytes <= 0)
{
return 0;
}
Expand All @@ -68,7 +68,10 @@ namespace s3d

if (m_writePos != static_cast<int64>(m_blob.size()))
{
m_blob.resize(newSize);
if (m_blob.size() < newSize)
{
m_blob.resize(newSize);
}

std::memcpy(&m_blob[static_cast<size_t>(m_writePos)], src, sizeBytes);
}
Expand Down

0 comments on commit 360cd39

Please sign in to comment.