From fef50a3d4800fb496927330ae93b7def4e7fbf61 Mon Sep 17 00:00:00 2001 From: Corban Mailloux Date: Fri, 24 Oct 2014 09:30:10 -0400 Subject: [PATCH] Handle the case where "name" exists twice in the result string, like when connecting to a server with another user logged in. --- MinecraftClient/Protocol/Handlers/Protocol17.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Protocol/Handlers/Protocol17.cs b/MinecraftClient/Protocol/Handlers/Protocol17.cs index fe97cae3..387c8bfc 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol17.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol17.cs @@ -544,7 +544,9 @@ namespace MinecraftClient.Protocol.Handlers if (tmp_ver.Length >= 2 && tmp_name.Length >= 2) { protocolversion = atoi(tmp_ver[1]); - version = tmp_name[1].Split('"')[0]; + + // Handle if "name" exists twice, like when connecting to a server with another user logged in. + version = (tmp_name.Length == 2) ? tmp_name[1].Split('"')[0] : tmp_name[2].Split('"')[0]; if (result.Contains("modinfo\":")) { //Server is running Forge (which is not supported)