summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-02-21 15:54:48 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-02-21 15:54:48 -0500
commit703f5f89a8d8eadede4d6fa4a9022283702608bd (patch)
tree3f94dee49fd0dba9cd9ba4df2cf9ee8f7a44fd31
parent7521570341b79ea78c590a202fbda55bd6fe06b7 (diff)
downloadSMAPI-703f5f89a8d8eadede4d6fa4a9022283702608bd.tar.gz
SMAPI-703f5f89a8d8eadede4d6fa4a9022283702608bd.tar.bz2
SMAPI-703f5f89a8d8eadede4d6fa4a9022283702608bd.zip
fix new error when entering an empty command in SMAPI console
-rw-r--r--src/StardewModdingAPI/Framework/CommandManager.cs3
-rw-r--r--src/StardewModdingAPI/Program.cs3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/StardewModdingAPI/Framework/CommandManager.cs b/src/StardewModdingAPI/Framework/CommandManager.cs
index 3aa4bf97..9af3d27a 100644
--- a/src/StardewModdingAPI/Framework/CommandManager.cs
+++ b/src/StardewModdingAPI/Framework/CommandManager.cs
@@ -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();
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index b14240ca..ea81d182 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -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);