From e7f352d6c24fb2e6d5bb5980a43f3e8d8899f9b0 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sat, 23 Oct 2021 12:16:08 -0700 Subject: [PATCH] Fix barotrauma damage total failing when damageable doesn't have the value --- Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs index 6259abdf7c..f1c2044c48 100644 --- a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs +++ b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs @@ -74,9 +74,11 @@ namespace Content.Server.Atmos.EntitySystems var totalDamage = 0; foreach (var (barotraumaDamageType, _) in barotrauma.Damage.DamageDict) { - totalDamage += damageable.Damage.DamageDict[barotraumaDamageType]; + if (!damageable.Damage.DamageDict.TryGetValue(barotraumaDamageType, out var damage)) + continue; + totalDamage += damage; } - if (totalDamage > barotrauma.MaxDamage) + if (totalDamage >= barotrauma.MaxDamage) continue; var uid = barotrauma.Owner.Uid;