Check menu is valid before calling functions on it

This commit is contained in:
EmiStorrs 2024-12-12 16:39:51 -05:00
parent 394f30251a
commit 1e0fd5cbfb

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);
} }