From d603a5e4dec01692acb489225b042c01c6bcb0c4 Mon Sep 17 00:00:00 2001 From: collinlunn <60152240+collinlunn@users.noreply.github.com> Date: Sun, 28 Feb 2021 03:59:47 -0700 Subject: [PATCH] MeleeChemicalInjectorComponent fix (#3449) --- .../Weapon/Melee/MeleeChemicalInjectorComponent.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeChemicalInjectorComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeChemicalInjectorComponent.cs index 2bd4c1d466..5873ffb54f 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeChemicalInjectorComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeChemicalInjectorComponent.cs @@ -1,4 +1,5 @@ -using Content.Server.GameObjects.Components.Body.Circulatory; +#nullable enable +using Content.Server.GameObjects.Components.Body.Circulatory; using Content.Server.GameObjects.Components.Chemistry; using Content.Shared.Chemistry; using Robust.Shared.GameObjects; @@ -29,7 +30,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee serializer.DataField(ref _transferEfficiency, "transferEfficiency", 1f); } - public override void HandleMessage(ComponentMessage message, IComponent component) + public override void HandleMessage(ComponentMessage message, IComponent? component) { base.HandleMessage(message, component); switch (message) @@ -48,6 +49,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee var hitBloodstreams = new List(); foreach (var entity in hitEntities) { + if (entity.Deleted) + continue; + if (entity.TryGetComponent(out var bloodstream)) hitBloodstreams.Add(bloodstream); }