Fix PVS exception (#5196)

This commit is contained in:
Leon Friedrich
2024-06-02 23:58:48 +12:00
committed by GitHub
parent ff4548f108
commit 6dd6b79db6
2 changed files with 10 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Robust.Server.GameStates;
using Robust.Shared.GameObjects;
using Robust.Shared.Utility;
namespace Robust.Server.GameObjects;
@@ -23,6 +24,8 @@ public sealed class UserInterfaceSystem : SharedUserInterfaceSystem
foreach (var ui in buis)
{
DebugTools.Assert(ent.Comp.OpenInterfaces[ui].Count > 0);
DebugTools.Assert(HasComp<UserInterfaceComponent>(ui));
args.Entities.Add(ui);
}
}

View File

@@ -100,7 +100,13 @@ internal sealed partial class PvsSystem
/// </summary>
private bool RecursivelyAddOverride(PvsSession session, EntityUid uid, GameTick fromTick, bool addChildren)
{
var xform = _xformQuery.GetComponent(uid);
if (!_xformQuery.TryGetComponent(uid, out var xform))
{
// Can happen if systems add deleted entities to PVS move event.
Log.Error($"Attempted to add non-existent entity {uid} to PVS override for session {session.Session}");
return false;
}
var parent = xform.ParentUid;
// First we process all parents. This is because while this entity may already have been added