From 7e0f56ccce9c2ac698be904667e450baa90b88cd Mon Sep 17 00:00:00 2001 From: Matyas Dolak Date: Mon, 16 Sep 2013 15:23:16 +0200 Subject: Attempt at fixing linux crash on player login. Ref.: http://forum.mc-server.org/showthread.php?tid=1244 --- source/Entities/Player.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/Entities/Player.cpp') diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp index 04d285b01..9132bdbd0 100644 --- a/source/Entities/Player.cpp +++ b/source/Entities/Player.cpp @@ -1448,7 +1448,17 @@ void cPlayer::SetSwimState(cChunk & a_Chunk) // Check if the player is swimming: // Use Unbounded, because we're being called *after* processing super::Tick(), which could have changed our chunk - VERIFY(a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockIn)); + if (!a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockIn)) + { + // This sometimes happens on Linux machines + // Ref.: http://forum.mc-server.org/showthread.php?tid=1244 + LOGD("SetSwimState failure: RelX = %d, RelZ = %d, LastPos = {%.02f, %.02f}, Pos = %.02f, %.02f}", + RelX, RelY, m_LastPosX, m_LastPosZ, GetPosX(), GetPosZ() + ); + m_IsSwimming = false; + m_IsSubmerged = false; + return; + } m_IsSwimming = IsBlockWater(BlockIn); // Check if the player is submerged: -- cgit v1.2.3