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:
@@ -2143,7 +2143,7 @@ namespace Barotrauma
|
|||||||
if (existingAffliction == null)
|
if (existingAffliction == null)
|
||||||
{
|
{
|
||||||
existingAffliction = afflictionPrefab.Instantiate(strength);
|
existingAffliction = afflictionPrefab.Instantiate(strength);
|
||||||
afflictions.Add(existingAffliction, limb);
|
afflictions.TryAdd(existingAffliction, limb);
|
||||||
newAdded = true;
|
newAdded = true;
|
||||||
}
|
}
|
||||||
existingAffliction.SetStrength(strength);
|
existingAffliction.SetStrength(strength);
|
||||||
|
|||||||
Reference in New Issue
Block a user