1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

fixed crash with CreateObject on ArrayType when count is 0

This commit is contained in:
xposure 2021-01-04 20:40:03 -05:00
parent 97d7324874
commit bd4c60a251

View file

@ -1120,7 +1120,8 @@ namespace System.Reflection
obj = Internal.UnsafeCastToObject(mem);
obj.[Friend]mClassVData = (.)(void*)[Friend]mTypeClassVData;
#endif
Internal.MemSet((uint8*)Internal.UnsafeCastToPtr(obj) + [Friend]mInstSize, 0, [Friend]arraySize - [Friend]mInstSize);
if(count > 0)
Internal.MemSet((uint8*)Internal.UnsafeCastToPtr(obj) + [Friend]mInstSize, 0, [Friend]arraySize - [Friend]mInstSize);
var array = (Array)obj;
array.[Friend]mLength = count;
return obj;