From 5d2afc0aa4eabe6afc7ee24f4ee4e044aea24d6e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 30 Apr 2023 13:43:23 -0400 Subject: [PATCH] fix error deserializing null semantic version --- docs/release-notes.md | 5 ++++- .../Serialization/Converters/SemanticVersionConverter.cs | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 0b0a37d8..c957484a 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -12,6 +12,9 @@ * In multiplayer, the game/SMAPI window titles now show whether you're the main player or a farmhand. * Fixed logged SMAPI errors not having line numbers on Linux/macOS. +* For mod authors: + * Fixed error loading a mod if it sets `"MinimumApiVersion": null` explicitly. + * For SMAPI toolkit users: * Fixed `ModFolder` not being JSON-serializable. @@ -23,7 +26,7 @@ Released 09 April 2023 for Stardew Valley 1.5.6 or later. * Fixed installer error for some Linux players due to a non-portable shebang (thanks to freyacoded!). * Fixed error using load order overrides when there are broken mods installed (thanks to atravita!). * Removed `LargeAddressAware` flag on SMAPI (no longer needed since it's 64-bit now). - * Improved translations. Thganks to stylemate (updated Korean)! + * Improved translations. Thanks to stylemate (updated Korean)! * For mod authors: * Added `IsActiveForScreen()` method to `PerScreen`. diff --git a/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs b/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs index 913d54e0..650815b5 100644 --- a/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs +++ b/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs @@ -44,6 +44,9 @@ namespace StardewModdingAPI.Toolkit.Serialization.Converters string path = reader.Path; switch (reader.TokenType) { + case JsonToken.Null: + return null; + case JsonToken.StartObject: return this.ReadObject(JObject.Load(reader));