diff --git a/Content.Server/GameObjects/Components/Nutrition/CreamPiedComponent.cs b/Content.Server/GameObjects/Components/Nutrition/CreamPiedComponent.cs index 917ca65617..1e1188efa9 100644 --- a/Content.Server/GameObjects/Components/Nutrition/CreamPiedComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/CreamPiedComponent.cs @@ -52,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Nutrition public void HitBy(ThrowCollideEventArgs eventArgs) { - if (!eventArgs.Thrown.TryGetComponent(out CreamPieComponent creamPie) || CreamPied) return; + if (!eventArgs.Thrown.HasComponent() || CreamPied) return; CreamPied = true; Owner.PopupMessage(Loc.GetString("You have been creamed by {0:theName}!", eventArgs.Thrown)); diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index c1ecd0d991..0210f5de3b 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -624,11 +624,13 @@ namespace Content.Server.GameObjects.EntitySystems.Click foreach (var comp in thrown.GetAllComponents().ToArray()) { + if (thrown.Deleted) break; comp.DoHit(eventArgs); } foreach (var comp in target.GetAllComponents().ToArray()) { + if (target.Deleted) break; comp.HitBy(eventArgs); } }