From 167df02e3d69dd0e8c8915944e6bab00417b15d5 Mon Sep 17 00:00:00 2001 From: sapier Date: Sun, 11 May 2014 15:39:38 +0200 Subject: [PATCH] Send max number of characters instead of asserting in case of too long chat messages --- src/client.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 871209a17..6b5072267 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -2082,8 +2082,10 @@ void Client::sendChatMessage(const std::wstring &message) // Write length size_t messagesize = message.size(); - assert(messagesize <= 0xFFFF); - writeU16(buf, (u16) (messagesize & 0xFFFF)); + if (messagesize > 0xFFFF) { + messagesize = 0xFFFF; + } + writeU16(buf, (u16) messagesize); os.write((char*)buf, 2); // Write string