Parameter value being passed is empty

The game works fine in the editor, but crashed when building and running. After using the debugger in Rider while running game, I get this error.

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000158

JotunheimShield_Win64_DebugGame!UAnimMontage::GetSectionIndex()
JotunheimShield_Win64_DebugGame!UAnimMontage::IsValidSectionName()
JotunheimShield_Win64_DebugGame!AVikingCharacter::PlayWeaponMontage() [C:\Users\chall\UE5\JotunheimShield\Source\JotunheimShield\Private\VikingCharacter.cpp:167]

It looks like the section name for the montage is not being passed into PlayWeaponMontage method. Here are the 2 methods. In MainAttack I pass in section name to for the montage. It looks like FName SectionName is null when it gets to PlayWeaponMontage.

header file

void PlayWeaponMontage(FName SectionName, float StaminaCost);
void AVikingCharacter::MainAttack()
{
	if (CharacterState == ECharacterState::Unoccupied && Stamina >= 5.f)
	{
		// Line trace to see if we hit something
		AttackTraceForActor();
		
		PlayWeaponMontage(FName("MainAttack"), 5.f);
	}
}
void AVikingCharacter::PlayWeaponMontage(FName SectionName, float StaminaCost)
{
		if (EquippedWeapon->GetWeaponMontage()->IsValidSectionName(SectionName))
		{
			UAnimInstance* AnimInstance = GetMesh()->GetAnimInstance();
			if (AnimInstance && EquippedWeapon->GetWeaponMontage())
			{
				CharacterState = ECharacterState::Attacking;
				AnimInstance->Montage_Play(EquippedWeapon->GetWeaponMontage());
				AnimInstance->Montage_JumpToSection(SectionName);
		
				// Get play length of section
				int32 const sectionIndex = EquippedWeapon->GetWeaponMontage()->GetSectionIndex(SectionName);
				float const SectionPlaytime = EquippedWeapon->GetWeaponMontage()->GetSectionLength(sectionIndex);
				GetWorldTimerManager().SetTimer(TimerWeaponMontage, this, &AVikingCharacter::SetCharacterUnoccupied, SectionPlaytime);

				// Take away stamina
				ReduceStamina(StaminaCost);
			}
		}
}

Problem has been solved.

I had an old UAnimMontage in the header file and the Character had it set to dagger montage. The new build uses the montage based on what weapon type the player as equipped. I forgot to remove the old UAnimMontage in the header. The new way of doing it is getting the montage from the weapon type datatable.

There where 2 dagger montages being set; 1 in the Character blueprint I forgot to delete and the other from the weampon datatable.