diff --git a/launcher/ui/pages/instance/McClient.cpp b/launcher/ui/pages/instance/McClient.cpp index f2cf1394f..f8a222645 100644 --- a/launcher/ui/pages/instance/McClient.cpp +++ b/launcher/ui/pages/instance/McClient.cpp @@ -117,17 +117,17 @@ int McClient::readVarInt(QByteArray &data) { int position = 0; char currentByte; - while (true) { + while (position < 32) { currentByte = readByte(data); value |= (currentByte & SEGMENT_BITS) << position; if ((currentByte & CONTINUE_BIT) == 0) break; position += 7; - - if (position >= 32) throw Exception("VarInt is too big"); } + if (position >= 32) throw Exception("VarInt is too big"); + return value; }