]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix handcuffed entity deletion and a mind shutdown error. (#21825)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Wed, 22 Nov 2023 00:53:30 +0000 (13:53 +1300)
committerGitHub <noreply@github.com>
Wed, 22 Nov 2023 00:53:30 +0000 (19:53 -0500)
* Fix handcuffed deletion error

* Fix mind shutdown error

Content.Server/Mind/MindSystem.cs
Content.Shared/Cuffs/SharedCuffableSystem.cs

index 4623c07052b5876fe48a4cec05be164d32431726..46ddb072cdb82d4c49f885e7047afe17b6edfcc1 100644 (file)
@@ -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;
         }
index 4951bb7f1cb410b92aae53dbb7e79b5cfa3eb12e..5dbe62aa6ae92357bf853a275b76d9f21e0984c0 100644 (file)
@@ -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);