From 4a466c5dbe5885c9d80decadc290725581bff4e4 Mon Sep 17 00:00:00 2001 From: Luxeator Date: Tue, 5 Aug 2025 19:15:16 -0400 Subject: [PATCH] Add guard to unbuckling to help it to not act upon terminating entities (#39410) * Add guard to unbuckling to help it to not act upon terminating entities * Refactor guard for unbuckling Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Revert "Refactor guard for unbuckling" This reverts commit bf975fbd6f5cfac45324a3d5d74e592ad17ad291. --------- Co-authored-by: Luxeator Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --- Content.Shared/Bed/SharedBedSystem.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Bed/SharedBedSystem.cs b/Content.Shared/Bed/SharedBedSystem.cs index 7e798111cf..0518f05fdf 100644 --- a/Content.Shared/Bed/SharedBedSystem.cs +++ b/Content.Shared/Bed/SharedBedSystem.cs @@ -56,8 +56,13 @@ public abstract class SharedBedSystem : EntitySystem private void OnUnstrapped(Entity bed, ref UnstrappedEvent args) { - _actionsSystem.RemoveAction(args.Buckle.Owner, bed.Comp.SleepAction); - _sleepingSystem.TryWaking(args.Buckle.Owner); + // If the entity being unbuckled is terminating, we shouldn't try to act upon it, as some components may be gone + if (!Terminating(args.Buckle.Owner)) + { + _actionsSystem.RemoveAction(args.Buckle.Owner, bed.Comp.SleepAction); + _sleepingSystem.TryWaking(args.Buckle.Owner); + } + RemComp(bed); } -- 2.51.2