From: Luxeator Date: Tue, 5 Aug 2025 23:15:16 +0000 (-0400) Subject: Add guard to unbuckling to help it to not act upon terminating entities (#39410) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=4a466c5dbe5885c9d80decadc290725581bff4e4;p=space-station-14.git 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> --- 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); }