diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-31 17:44:03 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-31 17:44:03 -0400 |
commit | 9c7858a28a8ae7e14a6654c41c2b5981d88b10ff (patch) | |
tree | 6e0ff09681bd74d225d2816614476a5f16cea23b /src | |
parent | f4a0632e0ea7c9d0c0f4d4886a2143016ab62cdf (diff) | |
download | SMAPI-9c7858a28a8ae7e14a6654c41c2b5981d88b10ff.tar.gz SMAPI-9c7858a28a8ae7e14a6654c41c2b5981d88b10ff.tar.bz2 SMAPI-9c7858a28a8ae7e14a6654c41c2b5981d88b10ff.zip |
tweak semantic version converter to avoid invalid cast errors
Diffstat (limited to 'src')
-rw-r--r-- | src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs b/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs index 9b2f5e7d..39e990d5 100644 --- a/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs +++ b/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs @@ -24,7 +24,7 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Converters /// <param name="objectType">The object type.</param> public override bool CanConvert(Type objectType) { - return typeof(ISemanticVersion).IsAssignableFrom(objectType); + return objectType == typeof(ISemanticVersion); } /// <summary>Reads the JSON representation of the object.</summary> @@ -82,7 +82,7 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Converters return null; if (!SemanticVersion.TryParse(str, out ISemanticVersion version)) throw new SParseException($"Can't parse semantic version from invalid value '{str}', should be formatted like 1.2, 1.2.30, or 1.2.30-beta (path: {path})."); - return (SemanticVersion)version; + return version; } } } |