Fixed MemoryStream::Read crash when just skipping (null buffer)
Former-commit-id: 46072c0ebd093bcfa1e7f54d11deb034cbc55dae
This commit is contained in:
parent
f722d83955
commit
c647b61904
|
|
@ -36,7 +36,10 @@ nzUInt64 NzMemoryStream::GetSize() const
|
||||||
std::size_t NzMemoryStream::Read(void* buffer, std::size_t size)
|
std::size_t NzMemoryStream::Read(void* buffer, std::size_t size)
|
||||||
{
|
{
|
||||||
unsigned int readSize = std::min(static_cast<unsigned int>(size), static_cast<unsigned int>(m_size-m_pos));
|
unsigned int readSize = std::min(static_cast<unsigned int>(size), static_cast<unsigned int>(m_size-m_pos));
|
||||||
std::memcpy(buffer, &m_ptr[m_pos], readSize);
|
|
||||||
|
if (buffer)
|
||||||
|
std::memcpy(buffer, &m_ptr[m_pos], readSize);
|
||||||
|
|
||||||
m_pos += readSize;
|
m_pos += readSize;
|
||||||
|
|
||||||
return readSize;
|
return readSize;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue