From 5580d558a5ede21f856d7b77c3f1ab99a4f088c4 Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Tue, 2 May 2017 13:16:59 +0200 Subject: Added missing checks for Initialize function and updated APIDoc --- src/Simulator/SandSimulator.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Simulator/SandSimulator.cpp') diff --git a/src/Simulator/SandSimulator.cpp b/src/Simulator/SandSimulator.cpp index 59990cea3..63fd8477d 100644 --- a/src/Simulator/SandSimulator.cpp +++ b/src/Simulator/SandSimulator.cpp @@ -62,7 +62,12 @@ void cSandSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, ); */ cFallingBlock * FallingBlock = new cFallingBlock(Pos, BlockType, a_Chunk->GetMeta(itr->x, itr->y, itr->z)); - FallingBlock->Initialize(m_World); + if (!FallingBlock->Initialize(m_World)) + { + delete FallingBlock; + FallingBlock = nullptr; + continue; + } a_Chunk->SetBlock(itr->x, itr->y, itr->z, E_BLOCK_AIR, 0); } } -- cgit v1.2.3