diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-04 23:36:03 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-04 23:36:03 -0400 |
commit | 6d7449d00b2aaf2909caf288aeb24a8c2fb94477 (patch) | |
tree | 701ea25a45c04eb5512e9d9e1fe83e05df73d90e /src/StardewModdingAPI/Program.cs | |
parent | 627f20b9c3d54e572262316e73f12050fd0dba54 (diff) | |
download | SMAPI-6d7449d00b2aaf2909caf288aeb24a8c2fb94477.tar.gz SMAPI-6d7449d00b2aaf2909caf288aeb24a8c2fb94477.tar.bz2 SMAPI-6d7449d00b2aaf2909caf288aeb24a8c2fb94477.zip |
fix error when checking for updates to a mod with no data record
Diffstat (limited to 'src/StardewModdingAPI/Program.cs')
-rw-r--r-- | src/StardewModdingAPI/Program.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 304de15d..7dfdc745 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -571,8 +571,13 @@ namespace StardewModdingAPI } // track update - ISemanticVersion localVersion = new SemanticVersion(mod.DataRecord?.GetLocalVersionForUpdateChecks(mod.Manifest.Version.ToString())); - ISemanticVersion latestVersion = new SemanticVersion(mod.DataRecord?.GetRemoteVersionForUpdateChecks(new SemanticVersion(info.Version).ToString())); + ISemanticVersion localVersion = mod.DataRecord != null + ? new SemanticVersion(mod.DataRecord.GetLocalVersionForUpdateChecks(mod.Manifest.Version.ToString())) + : mod.Manifest.Version; + ISemanticVersion latestVersion = new SemanticVersion(mod.DataRecord != null + ? mod.DataRecord.GetRemoteVersionForUpdateChecks(new SemanticVersion(info.Version).ToString()) + : info.Version + ); bool isUpdate = latestVersion.IsNewerThan(localVersion); this.VerboseLog($" {mod.DisplayName} ({result.Key}): {(isUpdate ? $"{mod.Manifest.Version}{(!localVersion.Equals(mod.Manifest.Version) ? $" [{localVersion}]" : "")} => {info.Version}{(!latestVersion.Equals(new SemanticVersion(info.Version)) ? $" [{latestVersion}]" : "")}" : "OK")}."); if (isUpdate) |