Fix crash when memory stream reading fails and perform soft error handling
#3612
This commit is contained in:
@@ -61,7 +61,11 @@ void MemoryReadStream::ReadBytes(void* data, uint32 bytes)
|
||||
{
|
||||
if (bytes > 0)
|
||||
{
|
||||
ASSERT(data && GetLength() - GetPosition() >= bytes);
|
||||
if (!data || GetLength() - GetPosition() < bytes)
|
||||
{
|
||||
_hasError = true;
|
||||
return;
|
||||
}
|
||||
Platform::MemoryCopy(data, _position, bytes);
|
||||
_position += bytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user