Something causing my Begin/EndOvelapEvent handlers to crash UE4

What I’m trying to do:

I have 3 weapons placed near each other in a way that a bit of their sphere components collide with each other so the character might be inside two sphere components at the same time.

When my character gets close to a weapon I show a small widget in the bottom of the screen with an icon representing the weapon and enable my character to pick it up (being picked up is handled by the weapon’s code). When my character gets far from the weapon or pick’s it up I hide the widget (Picking up the weapon will disable collision on the sphere component of the weapon thus triggering an end overlap event).

Since the character might be inside two spheres at the same time I made it so that only the newest overlapped weapon can get input and have its widget shown and when the end overlap event is triggered for the newest weapon I check currently overlapping actors to see if there’s a weapon in there and if there was one I enable its input and show its widget.

I was trying to see if my code works correctly so I just randomly moved my character in between the weapons and it worked like a charm and the widgets were changing correctly but after about a minute it suddenly it crashed. I commented out the content of the CheckOverlappingActors(), which does the stuff in bold in the previous paragraph, to see if the problem was from that function but it still crashed after about a minute. It sometimes crashes way faster so it’s happening when a rare condition is met I guess, but I don’t know what condition might be causing it. What am I doing wrong?

I put those logs to see when it crashes but every time it crashes either after End2 or after Begin2 so I don’t have any clues on what line is causing the crash.

Here’s my code:

void ATPSShooterCharacter::BOverlapHandler(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
	AMasterWeapon* OverlappedWeapon = Cast<AMasterWeapon>(OtherActor);
	if (OverlappedWeapon != nullptr) {
		UE_LOG(LogTemp, Warning, TEXT("Begin1"));
		if (CurrentOverlappedWeapon) {
			CurrentOverlappedWeapon->DisableInput(Cast<APlayerController>(GetController()));
			CurrentOverlappedWeapon->POwner = nullptr;
			if (CurrentOverlappedWeapon->WidgetInstance->IsInViewport()) {
				CurrentOverlappedWeapon->WidgetInstance->RemoveFromViewport();
			}
		}
		OverlappedWeapon->POwner = this;
		OverlappedWeapon->EnableInput(Cast<APlayerController>(GetController()));
		CurrentOverlappedWeapon = OverlappedWeapon;
		if (!OverlappedWeapon->WidgetInstance->IsInViewport()) {
			OverlappedWeapon->WidgetInstance->AddToViewport();
		}
		UE_LOG(LogTemp, Warning, TEXT("Begin2"));
	}
}

void ATPSShooterCharacter::EOverlapHandler(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
	AMasterWeapon* OverlappedWeapon = Cast<AMasterWeapon>(OtherActor);
	if (OverlappedWeapon != nullptr) {
		UE_LOG(LogTemp, Warning, TEXT("End1"));
		OverlappedWeapon->DisableInput(Cast<APlayerController>(GetController()));
		OverlappedWeapon->POwner = nullptr;
		if (CurrentOverlappedWeapon == OverlappedWeapon) {
			if (OverlappedWeapon->WidgetInstance->IsInViewport()) {
				OverlappedWeapon->WidgetInstance->RemoveFromViewport();
			}
			CurrentOverlappedWeapon = nullptr;
			CheckOverlappingActors();
		}
		UE_LOG(LogTemp, Warning, TEXT("End2"));
	}
}

EOverlap → EndOverlap, BOverlap → BeginOverlap