From e98abd923c3b85235ca2c66e75a9fa0a45bd9472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Wed, 21 Oct 2020 23:08:31 +0200 Subject: [PATCH] Fix crash related to reagent reactions --- .../GameObjects/Components/Nutrition/FoodComponent.cs | 2 +- Content.Shared/Chemistry/ReagentPrototype.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs index 019ad79ae7..0dbfc3f292 100644 --- a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs @@ -188,7 +188,7 @@ namespace Content.Server.GameObjects.Components.Nutrition foreach (var (reagentId, quantity) in split.Contents) { if (!_prototypeManager.TryIndex(reagentId, out ReagentPrototype reagent)) continue; - split.RemoveReagent(reagentId, reagent.ReactionEntity(target, ReactionMethod.Ingestion, quantity)); + split.RemoveReagent(reagentId, reagent.ReactionEntity(trueTarget, ReactionMethod.Ingestion, quantity)); } firstStomach.TryTransferSolution(split); diff --git a/Content.Shared/Chemistry/ReagentPrototype.cs b/Content.Shared/Chemistry/ReagentPrototype.cs index b68c4975e7..15e4f84b1e 100644 --- a/Content.Shared/Chemistry/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/ReagentPrototype.cs @@ -88,6 +88,9 @@ namespace Content.Shared.Chemistry { var removed = ReagentUnit.Zero; + if (entity == null || entity.Deleted) + return removed; + foreach (var react in entity.GetAllComponents()) { switch (method)