UMG and Inventory slots

Okay, I have tried to take your example into practice, and with this, I have added a command to my character:


void AMyGameCharacter::OpenInventory()
{
	Inventory->HUDWidgetInstance->AddToViewport();

}

I have confirmed that PostInitializeComponents is loaded by checking it with debug text, however as soon as I execute the above, UE4.6.1 crashes and I get the following error:

Access violation reading location 0x0000000000000430.

is the code for AInventoryHUD:


void AInventoryHUD::PostInitializeComponents()
{
	Super::PostInitializeComponents();
	
	HUDWidgetInstance = CreateWidget<UInventoryWidget>(Cast<APlayerController>(GetOwner()), HUDWidgetClass);
	//check(HUDWidgetInstance != nullptr); //This makes it crash as well.


	if (GEngine)
	{
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("TEST"));
	}
}