Fix handcuffed entity deletion and a mind shutdown error. (#21825)

* Fix handcuffed deletion error

* Fix mind shutdown error
This commit is contained in:
Leon Friedrich
2023-11-22 13:53:30 +13:00
committed by GitHub
parent 358de9b7df
commit aa59956134
2 changed files with 4 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ public sealed class MindSystem : SharedMindSystem
if (mind.UserId is {} user) if (mind.UserId is {} user)
{ {
UserMinds.Remove(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; oldData.Mind = null;
mind.UserId = null; mind.UserId = null;
} }

View File

@@ -619,6 +619,9 @@ namespace Content.Shared.Cuffs
if (!Resolve(target, ref cuffable) || !Resolve(cuffsToRemove, ref cuff)) if (!Resolve(target, ref cuffable) || !Resolve(cuffsToRemove, ref cuff))
return; return;
if (TerminatingOrDeleted(cuffsToRemove) || TerminatingOrDeleted(target))
return;
if (user != null) if (user != null)
{ {
var attempt = new UncuffAttemptEvent(user.Value, target); var attempt = new UncuffAttemptEvent(user.Value, target);