]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix key debug assert on round restart (#16296)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Thu, 11 May 2023 03:00:29 +0000 (03:00 +0000)
committerGitHub <noreply@github.com>
Thu, 11 May 2023 03:00:29 +0000 (13:00 +1000)
Content.Server/Radio/EntitySystems/HeadsetSystem.cs

index c84d28b4501cfe7c184996fff0aac8f07baafa5b..436149f076886f9a4292ed63ff1e48c459008ad1 100644 (file)
@@ -22,7 +22,7 @@ public sealed class HeadsetSystem : SharedHeadsetSystem
         SubscribeLocalEvent<HeadsetComponent, EncryptionChannelsChangedEvent>(OnKeysChanged);
 
         SubscribeLocalEvent<WearingHeadsetComponent, EntitySpokeEvent>(OnSpeak);
-        
+
         SubscribeLocalEvent<HeadsetComponent, EmpPulseEvent>(OnEmpPulse);
     }
 
@@ -33,7 +33,8 @@ public sealed class HeadsetSystem : SharedHeadsetSystem
 
     private void UpdateRadioChannels(EntityUid uid, HeadsetComponent headset, EncryptionKeyHolderComponent? keyHolder = null)
     {
-        if (!headset.Enabled)
+        // make sure to not add ActiveRadioComponent when headset is being deleted
+        if (!headset.Enabled || MetaData(uid).EntityLifeStage >= EntityLifeStage.Terminating)
             return;
 
         if (!Resolve(uid, ref keyHolder))