Subclass of UHierarchicalInstancedStaticMeshComponent causes crash on Hot-Reload

I ran into this in UE 4.20.

It looks like the bug is that, when scanning for references after hot reloading, it’s dereferencing “ClusterTreePtr” - which is null for the class default object.

My workaround for now is to override “Serialize()” like so:

void UMyDerivedHISMComponent::Serialize(FArchive& Ar)
{
	bool hasTempClusterTreePtr = false;
	if (Ar.IsObjectReferenceCollector() && !ClusterTreePtr.IsValid())
	{
		ClusterTreePtr = MakeShareable(new TArray<FClusterNode>);
		hasTempClusterTreePtr = true;
	}

	Super::Serialize(Ar);

	if (hasTempClusterTreePtr)
	{
		ClusterTreePtr = nullptr;
	}
}