From f089103c2b121f8128abfd6cdf0bd3cfbeca4465 Mon Sep 17 00:00:00 2001 From: Debucquoy Anthony tonitch Date: Sat, 18 Jun 2022 02:09:58 +0200 Subject: Additional Y height checks (#5405) For redstone wire, block area bindings, and fire simulator. Co-authored-by: Tiger Wang --- src/Simulator/FireSimulator.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/Simulator/FireSimulator.cpp') diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index d1eb8618c..a025f6afd 100644 --- a/src/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp @@ -363,14 +363,21 @@ void cFireSimulator::RemoveFuelNeighbors(cChunk * a_Chunk, Vector3i a_RelPos) { for (auto & coord : gNeighborCoords) { - BLOCKTYPE BlockType; auto relPos = a_RelPos + coord; - auto neighbor = a_Chunk->GetRelNeighborChunkAdjustCoords(relPos); - if (neighbor == nullptr) + + if (!cChunkDef::IsValidHeight(relPos)) + { + continue; + } + + const auto neighbor = a_Chunk->GetRelNeighborChunkAdjustCoords(relPos); + + if ((neighbor == nullptr) || !neighbor->IsValid()) { continue; } - BlockType = neighbor->GetBlock(relPos); + + BLOCKTYPE BlockType = neighbor->GetBlock(relPos); if (!IsFuel(BlockType)) { -- cgit v1.2.3