diff options
-rw-r--r-- | src/ClientHandle.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index a06ddd045..10920496d 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1884,7 +1884,10 @@ void cClientHandle::Tick(float a_Dt) cCSLock Lock(m_CSIncomingData); std::swap(IncomingData, m_IncomingData); } - m_Protocol->DataReceived(IncomingData.data(), IncomingData.size()); + if (!IncomingData.empty()) + { + m_Protocol->DataReceived(IncomingData.data(), IncomingData.size()); + } m_TicksSinceLastPacket += 1; if (m_TicksSinceLastPacket > 600) // 30 seconds time-out @@ -1968,7 +1971,10 @@ void cClientHandle::ServerTick(float a_Dt) cCSLock Lock(m_CSIncomingData); std::swap(IncomingData, m_IncomingData); } - m_Protocol->DataReceived(IncomingData.data(), IncomingData.size()); + if (!IncomingData.empty()) + { + m_Protocol->DataReceived(IncomingData.data(), IncomingData.size()); + } if (m_State == csAuthenticated) { |