diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-24 21:12:37 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-24 21:12:37 -0500 |
commit | 6fc1bf47136a620b3d270af6307426080b7d1ab2 (patch) | |
tree | b0b00bbd1b6b8c4d8e388dbd3d26e55964ae8334 /src/SMAPI | |
parent | 414cf5c197b5b59776d3dda914eb15710efb0868 (diff) | |
parent | f7d0cf40f651b4bf18dbb4fb6669caf1affa5e1e (diff) | |
download | SMAPI-6fc1bf47136a620b3d270af6307426080b7d1ab2.tar.gz SMAPI-6fc1bf47136a620b3d270af6307426080b7d1ab2.tar.bz2 SMAPI-6fc1bf47136a620b3d270af6307426080b7d1ab2.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Constants.cs | 2 | ||||
-rw-r--r-- | src/SMAPI/Framework/Events/ManagedEventBase.cs | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 8fe2b55b..3e57ded9 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -37,7 +37,7 @@ namespace StardewModdingAPI ** Public ****/ /// <summary>SMAPI's current semantic version.</summary> - public static ISemanticVersion ApiVersion { get; } = new SemanticVersion("2.5.0"); + public static ISemanticVersion ApiVersion { get; } = new SemanticVersion("2.5.1"); /// <summary>The minimum supported version of Stardew Valley.</summary> public static ISemanticVersion MinimumGameVersion { get; } = new SemanticVersion("1.2.30"); diff --git a/src/SMAPI/Framework/Events/ManagedEventBase.cs b/src/SMAPI/Framework/Events/ManagedEventBase.cs index cc4d89ec..7e42d613 100644 --- a/src/SMAPI/Framework/Events/ManagedEventBase.cs +++ b/src/SMAPI/Framework/Events/ManagedEventBase.cs @@ -55,7 +55,7 @@ namespace StardewModdingAPI.Framework.Events protected void AddTracking(TEventHandler handler, IEnumerable<TEventHandler> invocationList) { this.SourceMods[handler] = this.ModRegistry.GetFromStack(); - this.CachedInvocationList = invocationList.ToArray(); + this.CachedInvocationList = invocationList?.ToArray() ?? new TEventHandler[0]; } /// <summary>Remove tracking for an event handler.</summary> @@ -63,8 +63,9 @@ namespace StardewModdingAPI.Framework.Events /// <param name="invocationList">The updated event invocation list.</param> protected void RemoveTracking(TEventHandler handler, IEnumerable<TEventHandler> invocationList) { - this.SourceMods.Remove(handler); - this.CachedInvocationList = invocationList.ToArray(); + this.CachedInvocationList = invocationList?.ToArray() ?? new TEventHandler[0]; + if(!this.CachedInvocationList.Contains(handler)) // don't remove if there's still a reference to the removed handler (e.g. it was added twice and removed once) + this.SourceMods.Remove(handler); } /// <summary>Log an exception from an event handler.</summary> |