diff --git a/Chroma/Lighting/LightIDTableManager.cs b/Chroma/Lighting/LightIDTableManager.cs index 47241eea..eb94f7a6 100644 --- a/Chroma/Lighting/LightIDTableManager.cs +++ b/Chroma/Lighting/LightIDTableManager.cs @@ -140,19 +140,21 @@ internal static void UnregisterIndex(int lightID, int index) { foreach ((int key, int value) in dictioanry) { - if (value == index) + if (value != index) { - dictioanry.Remove(key); - if (ChromaConfig.Instance.PrintEnvironmentEnhancementDebug) - { - Log.Logger.Log($"Unregistered key [{key}] from light ID [{lightID}]."); - } + continue; + } - return; + dictioanry.Remove(key); + if (ChromaConfig.Instance.PrintEnvironmentEnhancementDebug) + { + Log.Logger.Log($"Unregistered key [{key}] from light ID [{lightID}]."); } - Log.Logger.Log("Could not find key to unregister.", Logger.Level.Warning); + return; } + + Log.Logger.Log("Could not find key to unregister.", Logger.Level.Warning); } else {