summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/StardewModdingAPI/Program.cs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 0c232b1d..a48fa716 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -316,9 +316,18 @@ namespace StardewModdingAPI
AppDomain.CurrentDomain.AssemblyResolve += (sender, e) => modAssemblyLoader.ResolveAssembly(e.Name);
// get known incompatible mods
- IDictionary<string, IncompatibleMod> incompatibleMods = File.Exists(Constants.ApiModMetadataPath)
- ? JsonConvert.DeserializeObject<IncompatibleMod[]>(File.ReadAllText(Constants.ApiModMetadataPath)).ToDictionary(p => p.ID, p => p)
- : new Dictionary<string, IncompatibleMod>(0);
+ IDictionary<string, IncompatibleMod> incompatibleMods;
+ try
+ {
+ incompatibleMods = File.Exists(Constants.ApiModMetadataPath)
+ ? JsonConvert.DeserializeObject<IncompatibleMod[]>(File.ReadAllText(Constants.ApiModMetadataPath)).ToDictionary(p => p.ID, p => p)
+ : new Dictionary<string, IncompatibleMod>(0);
+ }
+ catch (Exception ex)
+ {
+ incompatibleMods = new Dictionary<string, IncompatibleMod>();
+ Program.Monitor.Log($"Couldn't read metadata file at {Constants.ApiModMetadataPath}. SMAPI will still run, but some features may be disabled.\n{ex}", LogLevel.Warn);
+ }
// load mods
foreach (string directory in Directory.GetDirectories(Program.ModPath))