summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-05-28 16:40:46 +0200
committerMattes D <github@xoft.cz>2015-05-28 16:40:46 +0200
commita253f8d1a20325c31f361559aec2bb37bccaa4aa (patch)
tree9bf0a50f6fac9ab4af4c54ae79d0f148525ba757 /src
parentMerge pull request #2151 from SafwatHalaby/wolf (diff)
parentPotential crash fixes (diff)
downloadcuberite-a253f8d1a20325c31f361559aec2bb37bccaa4aa.tar
cuberite-a253f8d1a20325c31f361559aec2bb37bccaa4aa.tar.gz
cuberite-a253f8d1a20325c31f361559aec2bb37bccaa4aa.tar.bz2
cuberite-a253f8d1a20325c31f361559aec2bb37bccaa4aa.tar.lz
cuberite-a253f8d1a20325c31f361559aec2bb37bccaa4aa.tar.xz
cuberite-a253f8d1a20325c31f361559aec2bb37bccaa4aa.tar.zst
cuberite-a253f8d1a20325c31f361559aec2bb37bccaa4aa.zip
Diffstat (limited to 'src')
-rw-r--r--src/ClientHandle.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 765ccdee2..9644679d7 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1902,7 +1902,7 @@ void cClientHandle::Tick(float a_Dt)
if (m_TicksSinceLastPacket > 600) // 30 seconds time-out
{
SendDisconnect("Nooooo!! You timed out! D: Come back!");
- Destroy();
+ return;
}
if (m_Player == nullptr)
@@ -2013,7 +2013,6 @@ void cClientHandle::ServerTick(float a_Dt)
if (m_TicksSinceLastPacket > 600) // 30 seconds
{
SendDisconnect("Nooooo!! You timed out! D: Come back!");
- Destroy();
}
}
@@ -2186,6 +2185,7 @@ void cClientHandle::SendDisconnect(const AString & a_Reason)
{
LOGD("Sending a DC: \"%s\"", StripColorCodes(a_Reason).c_str());
m_Protocol->SendDisconnect(a_Reason);
+ Destroy();
m_HasSentDC = true;
}
}
@@ -2922,7 +2922,6 @@ void cClientHandle::PacketBufferFull(void)
// Too much data in the incoming queue, the server is probably too busy, kick the client:
LOGERROR("Too much data in queue for client \"%s\" @ %s, kicking them.", m_Username.c_str(), m_IPString.c_str());
SendDisconnect("Server busy");
- Destroy();
}
@@ -2936,7 +2935,6 @@ void cClientHandle::PacketUnknown(UInt32 a_PacketType)
AString Reason;
Printf(Reason, "Unknown [C->S] PacketType: 0x%x", a_PacketType);
SendDisconnect(Reason);
- Destroy();
}
@@ -2947,7 +2945,6 @@ void cClientHandle::PacketError(UInt32 a_PacketType)
{
LOGERROR("Protocol error while parsing packet type 0x%02x; disconnecting client \"%s\"", a_PacketType, m_Username.c_str());
SendDisconnect("Protocol error");
- Destroy();
}
@@ -2963,7 +2960,7 @@ void cClientHandle::SocketClosed(void)
LOGD("Client %s @ %s disconnected", m_Username.c_str(), m_IPString.c_str());
cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, "Player disconnected");
}
- if (m_State < csDestroying)
+ if ((m_State < csDestroying) && (m_Player != nullptr))
{
cWorld * World = m_Player->GetWorld();
if (World != nullptr)