aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-05-11 15:39:38 +0200
committersapier <Sapier at GMX dot net>2014-05-11 15:39:38 +0200
commit167df02e3d69dd0e8c8915944e6bab00417b15d5 (patch)
treee637cc90da88697a3f0d04c73119df06bb7fcf4e
parent5c6cf630de1733dfc8de24b49ddc90333dec2d2f (diff)
downloadminetest-167df02e3d69dd0e8c8915944e6bab00417b15d5.tar.gz
minetest-167df02e3d69dd0e8c8915944e6bab00417b15d5.tar.bz2
minetest-167df02e3d69dd0e8c8915944e6bab00417b15d5.zip
Send max number of characters instead of asserting in case of too long chat messages
-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