summaryrefslogtreecommitdiffstats
path: root/src/Simulator/FireSimulator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Simulator/FireSimulator.cpp')
-rw-r--r--src/Simulator/FireSimulator.cpp15
1 files changed, 11 insertions, 4 deletions
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))
{