Fix ComponentTogglerSystem deletion error (#37198)
Don't try to toggle if target is terminating or deleted
This commit is contained in:
@@ -17,6 +17,8 @@ public sealed class ComponentTogglerSystem : EntitySystem
|
||||
private void OnToggled(Entity<ComponentTogglerComponent> ent, ref ItemToggledEvent args)
|
||||
{
|
||||
var target = ent.Comp.Parent ? Transform(ent).ParentUid : ent.Owner;
|
||||
if (TerminatingOrDeleted(target))
|
||||
return;
|
||||
|
||||
if (args.Activated)
|
||||
EntityManager.AddComponents(target, ent.Comp.Components);
|
||||
|
||||
Reference in New Issue
Block a user