summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-25 22:52:40 +0100
committerMattes D <github@xoft.cz>2015-01-27 14:53:36 +0100
commit4eecf9363a2a1a729a553cec2cd43d1736e9e7e8 (patch)
treeba08e0e950d332f9b9d1faa1962196efe6ce9d84
parentAdded LibEvent license to the binary distribution pack. (diff)
downloadcuberite-4eecf9363a2a1a729a553cec2cd43d1736e9e7e8.tar
cuberite-4eecf9363a2a1a729a553cec2cd43d1736e9e7e8.tar.gz
cuberite-4eecf9363a2a1a729a553cec2cd43d1736e9e7e8.tar.bz2
cuberite-4eecf9363a2a1a729a553cec2cd43d1736e9e7e8.tar.lz
cuberite-4eecf9363a2a1a729a553cec2cd43d1736e9e7e8.tar.xz
cuberite-4eecf9363a2a1a729a553cec2cd43d1736e9e7e8.tar.zst
cuberite-4eecf9363a2a1a729a553cec2cd43d1736e9e7e8.zip
-rw-r--r--src/ClientHandle.cpp10
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)
{