From e8f7b72f1b20b6b3861ab8c7f247501618bb1df7 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 20 Aug 2013 21:17:33 +0200 Subject: [PATCH] Hotfix for #83. Do not tick the player while their chunk is invalid. --- source/Entities/Player.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp index 3ccb4ca1d..119afbafc 100644 --- a/source/Entities/Player.cpp +++ b/source/Entities/Player.cpp @@ -200,6 +200,12 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk) } } + if (!a_Chunk.IsValid()) + { + // This may happen if the cPlayer is created before the chunks have the chance of being loaded / generated (#83) + return; + } + super::Tick(a_Dt, a_Chunk); // Set player swimming state