Optimize Variant typename loading if length is zero

This commit is contained in:
Wojtek Figat
2021-01-28 00:02:37 +01:00
parent 4b11725226
commit 0de380ad3a

View File

@@ -228,6 +228,8 @@ void ReadStream::ReadVariantType(VariantType* data)
if (typeNameLength == MAX_int32)
{
ReadInt32(&typeNameLength);
if (typeNameLength == 0)
return;
data->TypeName = static_cast<char*>(Allocator::Allocate(typeNameLength + 1));
char* ptr = data->TypeName;
Read(ptr, typeNameLength);