Merge pull request #18 from emistorrs/PreventCrashOnCloseAll

Fix Crash When Changing Levels with Menu Open
This commit is contained in:
Steve Streeting 2024-12-13 10:24:33 +00:00 committed by GitHub
commit ccf640ddaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -300,9 +300,13 @@ void UMenuStack::CloseAll(bool bWasCancel)
{ {
// We don't go through normal pop sequence, this is a shot circuit // We don't go through normal pop sequence, this is a shot circuit
for (int i = Menus.Num() - 1; i >= 0; --i) for (int i = Menus.Num() - 1; i >= 0; --i)
{
UMenuBase* Menu = Menus[i];
if (IsValid(Menu))
{ {
Menus[i]->RemovedFromStack(this); Menus[i]->RemovedFromStack(this);
} }
}
Menus.Empty(); Menus.Empty();
LastMenuClosed(bWasCancel); LastMenuClosed(bWasCancel);
} }