Calling a HUD-function from Character class (read variable access violation)

Hey there,

I am trying to access a function inside my HUD-Class from my Character class. Now that works, but the game crashes trying to read a variable of the HUD-Class.

ASomCharacter.cpp , here the HUD-Function gets called

void ASomCharacter::PrintNotifyMessage(FText Message)
{
	//initiate owned PlayerController and HUD class
	APlayerController* SomPC = (APlayerController*)Controller;

	if (!SomPC && Role >= ROLE_Authority)
		return;

	ASomHUD* SomHUD = (ASomHUD*)(SomPC->GetHUD());

	SomHUD->NotifyMessages_AddMessage(Message);
}

ASomHUD.cpp , here lies the called HUD-Function

void ASomHUD::NotifyMessages_AddMessage(FText Message)
{

	//Substract lifetime from all entries but the first one
	if (NotifyMessages_Life.Num() > 0)
	{
		for (int32 iSubtract = 0; iSubtract < NotifyMessages_Life.Num(); iSubtract++)
		{
			NotifyMessages_Life[iSubtract] -= 150;
		}
	}

	NotifyMessages_Timer = 500;
	NotifyMessages.Add(Message);
	NotifyMessages_Life.Add(300);
}

It looks like the crash happens at line “if (NotifyMessages_Life.Num() > 0)” with an “access violation” … the “NotifyMessages_Life”-Array is an array inside the HUD-Class. What am I doing wrong?

Thanks in advance

Resolved. The “NotifyMessages_Life”-Array was “protected:” inside the HUD-class