Fix quote detection in /setrnd (#1915)

* Fix quote detection in /setrnd
Before the function crashed when entering quoted strings.
* Fix indentation
* Fix out of array error
This commit is contained in:
Daenges 2022-01-24 16:15:44 +01:00 committed by GitHub
parent bbe000b640
commit 095c9cf137
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View file

@ -107,7 +107,7 @@ namespace MinecraftClient
for (int i = 0; i < cmdLine.Length; i++) for (int i = 0; i < cmdLine.Length; i++)
{ {
if (cmdLine[i] == '"' && cmdLine[i - 1] != '\\') if ((cmdLine[i] == '"' && i > 0 && cmdLine[i-1] != '\\') || (cmdLine[i] == '"' && i == 0))
{ {
if (inQuotedArg) if (inQuotedArg)
{ {

View file

@ -1,5 +1,4 @@
using System; using System;
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@ -72,7 +71,5 @@ namespace MinecraftClient.Commands
} }
else return GetCmdDescTranslated(); else return GetCmdDescTranslated();
} }
} }
} }