summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release-notes.md1
-rw-r--r--src/StardewModdingAPI/Program.cs11
2 files changed, 10 insertions, 2 deletions
diff --git a/release-notes.md b/release-notes.md
index 81d770f0..797da19d 100644
--- a/release-notes.md
+++ b/release-notes.md
@@ -15,6 +15,7 @@ For players:
* Fixed installer not ignoring potential game folders that don't contain a Stardew Valley exe.
* Fixed installer not recognising Linux/Mac paths starting with `~/` or containing an escaped space.
* Fixed rare issue where mod dependencies would override SMAPI dependencies and cause unpredictable bugs.
+* Fixed errors in console command handlers causing the game to crash.
For mod developers:
* Added `SaveEvents.AfterReturnToTitle` and `TimeEvents.AfterDayStarted` events.
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 07857512..ebeefe96 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -535,8 +535,15 @@ namespace StardewModdingAPI
while (true)
{
string input = Console.ReadLine();
- if (!string.IsNullOrWhiteSpace(input) && !this.CommandManager.Trigger(input))
- this.Monitor.Log("Unknown command; type 'help' for a list of available commands.", LogLevel.Error);
+ try
+ {
+ if (!string.IsNullOrWhiteSpace(input) && !this.CommandManager.Trigger(input))
+ this.Monitor.Log("Unknown command; type 'help' for a list of available commands.", LogLevel.Error);
+ }
+ catch (Exception ex)
+ {
+ this.Monitor.Log($"The handler registered for that command failed:\n{ex.GetLogSummary()}", LogLevel.Error);
+ }
}
}