From aa5995613451239d1b5de7e620094eb91d1ab5ce Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Wed, 22 Nov 2023 13:53:30 +1300 Subject: [PATCH] Fix handcuffed entity deletion and a mind shutdown error. (#21825) * Fix handcuffed deletion error * Fix mind shutdown error --- Content.Server/Mind/MindSystem.cs | 2 +- Content.Shared/Cuffs/SharedCuffableSystem.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Content.Server/Mind/MindSystem.cs b/Content.Server/Mind/MindSystem.cs index 4623c07052..46ddb072cd 100644 --- a/Content.Server/Mind/MindSystem.cs +++ b/Content.Server/Mind/MindSystem.cs @@ -40,7 +40,7 @@ public sealed class MindSystem : SharedMindSystem if (mind.UserId is {} user) { UserMinds.Remove(user); - if (_players.GetPlayerData(user).ContentData() is { } oldData) + if (_players.TryGetPlayerData(user, out var data) && data.ContentData() is { } oldData) oldData.Mind = null; mind.UserId = null; } diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 4951bb7f1c..5dbe62aa6a 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -619,6 +619,9 @@ namespace Content.Shared.Cuffs if (!Resolve(target, ref cuffable) || !Resolve(cuffsToRemove, ref cuff)) return; + if (TerminatingOrDeleted(cuffsToRemove) || TerminatingOrDeleted(target)) + return; + if (user != null) { var attempt = new UncuffAttemptEvent(user.Value, target); -- 2.51.2