From 095c9cf13777a93933256a7b4d2544ade2a31a23 Mon Sep 17 00:00:00 2001 From: Daenges <57369924+Daenges@users.noreply.github.com> Date: Mon, 24 Jan 2022 16:15:44 +0100 Subject: [PATCH] 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 --- MinecraftClient/Command.cs | 2 +- MinecraftClient/Commands/SetRnd.cs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/MinecraftClient/Command.cs b/MinecraftClient/Command.cs index fbcd13e4..14003534 100644 --- a/MinecraftClient/Command.cs +++ b/MinecraftClient/Command.cs @@ -107,7 +107,7 @@ namespace MinecraftClient 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) { diff --git a/MinecraftClient/Commands/SetRnd.cs b/MinecraftClient/Commands/SetRnd.cs index efed8db0..ea4f0b84 100644 --- a/MinecraftClient/Commands/SetRnd.cs +++ b/MinecraftClient/Commands/SetRnd.cs @@ -1,5 +1,4 @@ -using System; -using System.Linq; +using System; using System.Collections.Generic; using System.Text; @@ -72,7 +71,5 @@ namespace MinecraftClient.Commands } else return GetCmdDescTranslated(); } - - } }