We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f9d281 commit fc787e4Copy full SHA for fc787e4
src/CLR/Core/TypeSystem.cpp
@@ -2546,6 +2546,16 @@ HRESULT CLR_RT_TypeDescriptor::InitializeFromObject(const CLR_RT_HeapBlock &ref)
2546
{
2547
obj = (CLR_RT_HeapBlock *)array->GetElement(obj->ArrayIndex());
2548
2549
+ // For reference arrays, if the element is null, we need to get the type from the array's element
2550
+ // type rather than trying to dereference a null object
2551
+ if (obj->Dereference() == nullptr)
2552
+ {
2553
+ // Use the array's element type.
2554
+ // Keep 'reflex' null to avoid carrying array levels when returning an element type.
2555
+ cls = &(array->ReflectionDataConst().data.type);
2556
+ break;
2557
+ }
2558
+
2559
NANOCLR_SET_AND_LEAVE(InitializeFromObject(*obj));
2560
}
2561
0 commit comments