From e64bed7bdbf39511d2c35f8822bfbd2cf02fd198 Mon Sep 17 00:00:00 2001 From: RogueException Date: Sun, 29 Nov 2015 11:18:11 -0400 Subject: [PATCH] Fixed error --- src/Discord.Net.Commands/CommandParser.cs | 25 ++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Discord.Net.Commands/CommandParser.cs b/src/Discord.Net.Commands/CommandParser.cs index 564a4fb68..fbd7f2fc2 100644 --- a/src/Discord.Net.Commands/CommandParser.cs +++ b/src/Discord.Net.Commands/CommandParser.cs @@ -96,6 +96,7 @@ namespace Discord.Commands else if (currentChar == '\\') isEscaped = true; + bool isWhitespace = IsWhiteSpace(currentChar); if (endPosition == startPosition + 1 && isWhitespace) //Has no text yet, and is another whitespace { startPosition = endPosition; @@ -115,23 +116,19 @@ namespace Discord.Commands currentPart = ParserPart.QuotedParameter; startPosition = endPosition; } - else + else if ((!isEscaped && isWhitespace) || endPosition >= inputLength) { - bool isWhitespace = IsWhiteSpace(currentChar); - if ((!isEscaped && isWhitespace) || endPosition >= inputLength) + int length = (isWhitespace ? endPosition - 1 : endPosition) - startPosition; + string temp = input.Substring(startPosition, length); + if (temp == "") + startPosition = endPosition; + else { - int length = (isWhitespace ? endPosition - 1 : endPosition) - startPosition; - string temp = input.Substring(startPosition, length); - if (temp == "") - startPosition = endPosition; - else - { - currentPart = ParserPart.None; - argList.Add(temp); - startPosition = endPosition; - } + currentPart = ParserPart.None; + argList.Add(temp); + startPosition = endPosition; } - } + } break; case ParserPart.QuotedParameter: if ((!isEscaped && currentChar == '\''))