diff --git a/hats/Hat.cs b/hats/Hat.cs index 483ef8a..d3438d1 100644 --- a/hats/Hat.cs +++ b/hats/Hat.cs @@ -30,6 +30,11 @@ public void DestroyInstances() List> toRemove = new List>(); foreach (var kvp in Plugin.Singleton.hats.Where(x => x.Value.hat == this)) { + if (kvp.Value is null || kvp.Value.gameObject.Equals(null) || !kvp.Value.schem.isActiveAndEnabled) + { + toRemove.Add(kvp); + continue; + } kvp.Value.DoDestroy(); toRemove.Add(kvp); }