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

Merge pull request #795 from xposure/master

fixed crash with CreateObject on ArrayType when count is 0
This commit is contained in:
Brian Fiete 2021-01-06 09:03:50 -08:00 committed by GitHub
commit 7d23978cfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1120,7 +1120,9 @@ namespace System.Reflection
obj = Internal.UnsafeCastToObject(mem); obj = Internal.UnsafeCastToObject(mem);
obj.[Friend]mClassVData = (.)(void*)[Friend]mTypeClassVData; obj.[Friend]mClassVData = (.)(void*)[Friend]mTypeClassVData;
#endif #endif
Internal.MemSet((uint8*)Internal.UnsafeCastToPtr(obj) + [Friend]mInstSize, 0, [Friend]arraySize - [Friend]mInstSize); //Array1 holds the first element, we only want to set the remaining elements
if(count > 1)
Internal.MemSet((uint8*)Internal.UnsafeCastToPtr(obj) + [Friend]mInstSize, 0, [Friend]arraySize - [Friend]mInstSize);
var array = (Array)obj; var array = (Array)obj;
array.[Friend]mLength = count; array.[Friend]mLength = count;
return obj; return obj;