aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client.cpp6
1 files 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