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.
This commit is contained in:
Eero
2025-12-28 15:11:56 +08:00
parent f485583621
commit ad0bcddaa4

View File

@@ -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);