Core/MemoryStream: Fix assertion trigger when writing zero-sized block

This commit is contained in:
Lynix 2017-12-09 20:34:07 +01:00
parent 7772d56c66
commit 24278dafdc
1 changed files with 10 additions and 6 deletions

View File

@ -129,6 +129,8 @@ namespace Nz
*/
std::size_t MemoryStream::WriteBlock(const void* buffer, std::size_t size)
{
if (size > 0)
{
std::size_t endPos = static_cast<std::size_t>(m_pos + size);
if (endPos > m_buffer->GetSize())
@ -139,6 +141,8 @@ namespace Nz
std::memcpy(m_buffer->GetBuffer() + m_pos, buffer, size);
m_pos = endPos;
}
return size;
}
}