Merge branch 'develop' into stable

This commit is contained in:
Jesse Plamondon-Willard 2018-02-24 21:12:37 -05:00
commit 6fc1bf4713
5 changed files with 12 additions and 7 deletions

View File

@ -1,5 +1,5 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyProduct("SMAPI")] [assembly: AssemblyProduct("SMAPI")]
[assembly: AssemblyVersion("2.5.0")] [assembly: AssemblyVersion("2.5.1")]
[assembly: AssemblyFileVersion("2.5.0")] [assembly: AssemblyFileVersion("2.5.1")]

View File

@ -1,4 +1,8 @@
# Release notes # Release notes
## 2.5.1
* For players:
* Fixed event error in rare cases.
## 2.5 ## 2.5
* For players: * For players:
* **Added support for [content packs](https://stardewvalleywiki.com/Modding:Content_packs)**. * **Added support for [content packs](https://stardewvalleywiki.com/Modding:Content_packs)**.

View File

@ -1,7 +1,7 @@
{ {
"Name": "Console Commands", "Name": "Console Commands",
"Author": "SMAPI", "Author": "SMAPI",
"Version": "2.5.0", "Version": "2.5.1",
"Description": "Adds SMAPI console commands that let you manipulate the game.", "Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands", "UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll" "EntryDll": "ConsoleCommands.dll"

View File

@ -37,7 +37,7 @@ namespace StardewModdingAPI
** Public ** Public
****/ ****/
/// <summary>SMAPI's current semantic version.</summary> /// <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> /// <summary>The minimum supported version of Stardew Valley.</summary>
public static ISemanticVersion MinimumGameVersion { get; } = new SemanticVersion("1.2.30"); public static ISemanticVersion MinimumGameVersion { get; } = new SemanticVersion("1.2.30");

View File

@ -55,7 +55,7 @@ namespace StardewModdingAPI.Framework.Events
protected void AddTracking(TEventHandler handler, IEnumerable<TEventHandler> invocationList) protected void AddTracking(TEventHandler handler, IEnumerable<TEventHandler> invocationList)
{ {
this.SourceMods[handler] = this.ModRegistry.GetFromStack(); 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> /// <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> /// <param name="invocationList">The updated event invocation list.</param>
protected void RemoveTracking(TEventHandler handler, IEnumerable<TEventHandler> invocationList) protected void RemoveTracking(TEventHandler handler, IEnumerable<TEventHandler> invocationList)
{ {
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); this.SourceMods.Remove(handler);
this.CachedInvocationList = invocationList.ToArray();
} }
/// <summary>Log an exception from an event handler.</summary> /// <summary>Log an exception from an event handler.</summary>