Cant access array

Im using an array of pointers to my inventory actor thingy, and every time i add an item to the array, I can’t access it from my hud. The item just gives me memory errors

The array is replicated and I added items to the array on the server side, I don’t know whats wrong

heres the snippet of code from my hud widget

const FSlateBrush* SHumanInventoryWidget::GetLHandIcon() const
{
	if (PCOwner.IsValid())
	{
		TWeakObjectPtr<ADefaultHuman> OwningHuman = Cast<ADefaultHuman>(PCOwner->GetPawn());

		if (OwningHuman.IsValid() && OwningHuman->GetInventory().IsValidIndex(0))
		{
			if (OwningHuman->GetInventoryItem(0))
			{
				return MyGameUIResources->GetBrush(OwningHuman->GetInventoryItem(0)->IconDirectory);
			}
			else
			{
				return MyGameUIResources->GetBrush(FName("/icons/DefaultInventoryIcon"));
			}
		}
		else
		{
			return MyGameUIResources->GetBrush(FName("/icons/DefaultInventoryIcon"));
		}
	}
	else
	{
		return MyGameUIResources->GetBrush(FName("/icons/DefaultInventoryIcon"));
	}
}

heres the code for adding in the array item

void ADefaultHuman::InitializeInventory_Implementation(uint8 InventoryType)
{
	AIDCard_Inventory* const SpawnedCard = (AIDCard_Inventory*) GetWorld()->SpawnActor<AIDCard_Inventory>(AIDCard_Inventory::StaticClass());

	AMyGameHUD* HUD = Cast<AMyGameHUD>(Cast<APlayerController>(Controller)->GetHUD());
	SpawnedCard->IDName = PreferredName;

	switch (InventoryType)
	{
	case 1:
		InventoryItems.Empty();
		//InventoryItems.Max = 10;
		InventoryItems.Add(SpawnedCard);
		//InventoryItems.Insert(SpawnedCard, 0);
		//InventoryItems.Insert(SpawnedCard, 1);
		return;

	default:
		InventoryItems.Empty();
		//InventoryItems.Max = 10;
		InventoryItems.Add(SpawnedCard);
		//InventoryItems.Insert(SpawnedCard, 0);
		//InventoryItems.Insert(SpawnedCard, 1);
		return;
	}
}