fix new error when entering an empty command in SMAPI console

This commit is contained in:
Jesse Plamondon-Willard 2017-02-21 15:54:48 -05:00
parent 7521570341
commit 703f5f89a8
2 changed files with 4 additions and 2 deletions

View File

@ -70,6 +70,9 @@ namespace StardewModdingAPI.Framework
/// <returns>Returns whether a matching command was triggered.</returns>
public bool Trigger(string input)
{
if (string.IsNullOrWhiteSpace(input))
return false;
string[] args = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
string name = args[0];
args = args.Skip(1).ToArray();

View File

@ -575,7 +575,7 @@ namespace StardewModdingAPI
while (true)
{
string input = Console.ReadLine();
if (!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);
}
}
@ -587,7 +587,6 @@ namespace StardewModdingAPI
{
if (arguments.Any())
{
Framework.Command result = this.CommandManager.Get(arguments[0]);
if (result == null)
this.Monitor.Log("There's no command with that name.", LogLevel.Error);