]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Don't spawn midi timer for inactive instruments (#14300)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Fri, 24 Mar 2023 02:47:38 +0000 (13:47 +1100)
committerGitHub <noreply@github.com>
Fri, 24 Mar 2023 02:47:38 +0000 (13:47 +1100)
Content.Client/Instruments/InstrumentSystem.cs

index 11ceb36df5514fcdaa2a3b04c08cefeaad3f5dd8..009fa6bcc521e31e5920973e8627dc1853c6bab2 100644 (file)
@@ -87,7 +87,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
         if (!Resolve(uid, ref instrument) || instrument.Renderer == null)
             return;
 
-        instrument.Renderer.TrackingEntity = instrument.Owner;
+        instrument.Renderer.TrackingEntity = uid;
         instrument.Renderer.DisablePercussionChannel = !instrument.AllowPercussion;
         instrument.Renderer.DisableProgramChangeEvent = !instrument.AllowProgramChange;
 
@@ -127,7 +127,9 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
 
         // We dispose of the synth two seconds from now to allow the last notes to stop from playing.
         // Don't use timers bound to the entity in case it is getting deleted.
-        Timer.Spawn(2000, () => { renderer?.Dispose(); });
+        if (renderer != null)
+            Timer.Spawn(2000, () => { renderer.Dispose(); });
+
         instrument.Renderer = null;
         instrument.MidiEventBuffer.Clear();