Try/catch blocks around BUI open/dispose calls (#5730)

This commit is contained in:
Whatstone
2025-03-07 23:16:11 -05:00
committed by GitHub
parent 41ea10083d
commit 3dda8d9e93

View File

@@ -1064,11 +1064,11 @@ public abstract class SharedUserInterfaceSystem : EntitySystem
{
if (open)
{
bui.Open();
#if EXCEPTION_TOLERANCE
try
{
#endif
bui.Open();
if (UIQuery.TryComp(bui.Owner, out var uiComp))
{
@@ -1096,12 +1096,24 @@ public abstract class SharedUserInterfaceSystem : EntitySystem
uiComp.ClientOpenInterfaces.Remove(bui.UiKey);
}
#if EXCEPTION_TOLERANCE
try
{
#endif
if (!TerminatingOrDeleted(bui.Owner))
{
SavePosition(bui);
}
bui.Dispose();
#if EXCEPTION_TOLERANCE
}
catch (Exception e)
{
Log.Error(
$"Caught exception while attempting to dispose of a BUI {bui.UiKey} with type {bui.GetType()} on entity {ToPrettyString(bui.Owner)}. Exception: {e}");
}
#endif
}
}