fix errors in console command handlers crashing the game
This commit is contained in:
parent
6de4888a1b
commit
696bdab3cd
|
@ -15,6 +15,7 @@ For players:
|
||||||
* Fixed installer not ignoring potential game folders that don't contain a Stardew Valley exe.
|
* 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 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 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:
|
For mod developers:
|
||||||
* Added `SaveEvents.AfterReturnToTitle` and `TimeEvents.AfterDayStarted` events.
|
* Added `SaveEvents.AfterReturnToTitle` and `TimeEvents.AfterDayStarted` events.
|
||||||
|
|
|
@ -535,9 +535,16 @@ namespace StardewModdingAPI
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
string input = Console.ReadLine();
|
string input = Console.ReadLine();
|
||||||
|
try
|
||||||
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(input) && !this.CommandManager.Trigger(input))
|
if (!string.IsNullOrWhiteSpace(input) && !this.CommandManager.Trigger(input))
|
||||||
this.Monitor.Log("Unknown command; type 'help' for a list of available commands.", LogLevel.Error);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method called when the user submits the help command in the console.</summary>
|
/// <summary>The method called when the user submits the help command in the console.</summary>
|
||||||
|
|
Loading…
Reference in New Issue