Guard against trying to take focus on shutdown

This commit is contained in:
Steve Streeting 2024-06-27 16:10:28 +01:00
parent 7fb56434ec
commit 191ab410aa

View File

@ -66,7 +66,8 @@ void FFocusSystem::FocusableWidgetDestructed(UFocusableUserWidget* Widget)
if (Widget->HasFocusedDescendants())
{
auto Highest = GetHighestFocusPriority();
if (Highest.IsValid())
// Make sure player controller is valid too, this could be on shutdown
if (Highest.IsValid() && Highest->GetOwningPlayer())
{
UE_LOG(LogFocusSystem, Display, TEXT("Giving focus to %s"), *Highest->GetName());
Highest->TakeFocusIfDesired();