add error catch to serialize

This commit is contained in:
Mister_Nebula 2021-12-05 23:32:01 +00:00
parent d75136bbc3
commit c17ea7607f

View File

@ -1257,7 +1257,16 @@ namespace QuantumUNET
if (handlers.ContainsKey(msgType) && m_LocalConnection != null)
{
var writer = new QNetworkWriter();
msg.Serialize(writer);
try
{
msg.Serialize(writer);
}
catch (Exception ex)
{
QLog.Error($"Error serializing msgId:{msgType} - {ex}");
return false;
}
var reader = new QNetworkReader(writer);
m_LocalConnection.InvokeHandler(msgType, reader, channelId);
result = true;