mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Remove raw message output on AOM deserialization failure
Improve TOCLIENT_ACTIVE_OBJECT_MESSAGES robustness for handling invalid data
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user