projects
/
zefram
/
minetest
/
minetest_engine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5c6cf63
)
Send max number of characters instead of asserting in case of too long chat messages
author
sapier
<Sapier at GMX dot net>
Sun, 11 May 2014 13:39:38 +0000
(15:39 +0200)
committer
sapier
<Sapier at GMX dot net>
Sun, 11 May 2014 13:39:38 +0000
(15:39 +0200)
src/client.cpp
patch
|
blob
|
history
diff --git
a/src/client.cpp
b/src/client.cpp
index 871209a17089463ff5ffa9daf97b0cc5d7597ded..6b5072267ed1221ca0db60a45e89f9a6c7ee67f7 100644
(file)
--- 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