1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Remove raw message output on AOM deserialization failure

Improve TOCLIENT_ACTIVE_OBJECT_MESSAGES robustness for handling invalid data
This commit is contained in:
kwolekr 2015-07-13 23:29:29 -04:00
parent 6f07f79c2f
commit 5006ce8260
2 changed files with 21 additions and 36 deletions

View file

@ -2535,28 +2535,23 @@ void ClientEnvironment::removeActiveObject(u16 id)
m_active_objects.erase(id);
}
void ClientEnvironment::processActiveObjectMessage(u16 id,
const std::string &data)
void ClientEnvironment::processActiveObjectMessage(u16 id, const std::string &data)
{
ClientActiveObject* obj = getActiveObject(id);
if(obj == NULL)
{
infostream<<"ClientEnvironment::processActiveObjectMessage():"
<<" got message for id="<<id<<", which doesn't exist."
<<std::endl;
ClientActiveObject *obj = getActiveObject(id);
if (obj == NULL) {
infostream << "ClientEnvironment::processActiveObjectMessage():"
<< " got message for id=" << id << ", which doesn't exist."
<< std::endl;
return;
}
try
{
try {
obj->processMessage(data);
}
catch(SerializationError &e)
{
} catch (SerializationError &e) {
errorstream<<"ClientEnvironment::processActiveObjectMessage():"
<<" id="<<id<<" type="<<obj->getType()
<<" SerializationError in processMessage(),"
<<" message="<<serializeJsonString(data)
<<std::endl;
<< " id=" << id << " type=" << obj->getType()
<< " SerializationError in processMessage(): " << e.what()
<< std::endl;
}
}