Compare commits

..

2 Commits

Author SHA1 Message Date
Steve Streeting
ccf640ddaf
Merge pull request #18 from emistorrs/PreventCrashOnCloseAll
Fix Crash When Changing Levels with Menu Open
2024-12-13 10:24:33 +00:00
EmiStorrs
1e0fd5cbfb Check menu is valid before calling functions on it 2024-12-12 16:39:51 -05:00

View File

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