From c9d8e06331b546254ebf0db62f6dab1619be5bb3 Mon Sep 17 00:00:00 2001 From: Delta Date: Wed, 25 Oct 2023 04:23:33 -0700 Subject: [PATCH] Call OnChanged on Unset() --- ResoniteModLoader/ModConfigurationKey.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ResoniteModLoader/ModConfigurationKey.cs b/ResoniteModLoader/ModConfigurationKey.cs index bdacdad..4434e3d 100644 --- a/ResoniteModLoader/ModConfigurationKey.cs +++ b/ResoniteModLoader/ModConfigurationKey.cs @@ -102,13 +102,18 @@ internal void Set(object? value) { try { OnChanged?.SafeInvoke(value); } catch (Exception e) { - Logger.ErrorInternal($"An OnChanged event subscriber for {this.Name} threw an exception:\n{e}"); + Logger.ErrorInternal($"An OnChanged event subscriber for {Name} threw an exception:\n{e}"); } } internal bool Unset() { bool hadValue = HasValue; HasValue = false; + try { + OnChanged?.SafeInvoke(); + } catch (Exception e) { + Logger.ErrorInternal($"An OnChanged event subscriber for {Name} threw an exception:\n{e}"); + } return hadValue; } }