From c4129cf6450719120480e2ae4f43724d27f8185c Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 9 Dec 2017 15:19:34 +1030 Subject: [PATCH 1/2] Updates the commandline parser to not be broken. It should now correctly parse a commandline such as `["", "-flag", "-flag", "arg" ... "etc" ]` --- TShockAPI/CLI/CommandLineParser.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/TShockAPI/CLI/CommandLineParser.cs b/TShockAPI/CLI/CommandLineParser.cs index 7106abbe..d84a7732 100644 --- a/TShockAPI/CLI/CommandLineParser.cs +++ b/TShockAPI/CLI/CommandLineParser.cs @@ -165,10 +165,16 @@ namespace TShockAPI.CLI { _source = source; - for (int i = 0; i < (source.Length - 1 == 0 ? 1 : source.Length - 1); i++) + for (int i = 0; i < (source.Length - 1 == 0 ? 1 : source.Length); i++) { string flag = source[i].ToLowerInvariant(); string argument = null; + + if (string.IsNullOrWhiteSpace(flag)) + { + continue; + } + if (i + 1 < source.Length) { argument = source[i + 1]; From c1e72bbc251ebdd8ce20b1b1a8482348a4d2f641 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 9 Dec 2017 15:30:57 +1030 Subject: [PATCH 2/2] Changelog update --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14bce826..08b19051 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Fixed /savessc not bothering to save ssc data for people who bypass ssc. (@hakusaro) * Default permission sets for new databases are more modern. (@hakusaro) * Added the ability to ban by account name instead of just banning a character name assuming its an account name. (@hakusaro) +* Fixed a bug in the CommandLineParser which caused some command lines to fail (@QuicM) ## TShock 4.3.24 * Updated OpenTerraria API to 1.3.5.3 (@DeathCradle)