From ad0bcddaa49fb3108bfea35c3a624a9bd2318e22 Mon Sep 17 00:00:00 2001 From: Eero Date: Sun, 28 Dec 2025 15:11:56 +0800 Subject: [PATCH] CL_Fix Use TryAdd when adding afflictions to dictionary Replaces afflictions.Add with afflictions.TryAdd to prevent exceptions if the affliction already exists in the dictionary. --- .../ClientSource/Characters/Health/CharacterHealth.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaClient/ClientSource/Characters/Health/CharacterHealth.cs index 9e38c0b43..0c126392c 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Characters/Health/CharacterHealth.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Characters/Health/CharacterHealth.cs @@ -2143,7 +2143,7 @@ namespace Barotrauma if (existingAffliction == null) { existingAffliction = afflictionPrefab.Instantiate(strength); - afflictions.Add(existingAffliction, limb); + afflictions.TryAdd(existingAffliction, limb); newAdded = true; } existingAffliction.SetStrength(strength);