diff options
Diffstat (limited to 'src/Blocks/BlockRail.h')
-rw-r--r-- | src/Blocks/BlockRail.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 4e2e6211f..48f20a86b 100644 --- a/src/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h @@ -177,11 +177,17 @@ private: virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, NIBBLETYPE a_Meta) const override { + const auto BelowPos = a_Position.addedY(-1); + if (!cChunkDef::IsValidHeight(BelowPos)) + { + return false; + } + BLOCKTYPE BelowBlock; NIBBLETYPE BelowBlockMeta; - a_Chunk.GetBlockTypeMeta(a_Position.addedY(-1), BelowBlock, BelowBlockMeta); + a_Chunk.GetBlockTypeMeta(BelowPos, BelowBlock, BelowBlockMeta); - if ((a_Position.y <= 0) || !CanBeSupportedBy(BelowBlock, BelowBlockMeta)) + if (!CanBeSupportedBy(BelowBlock, BelowBlockMeta)) { return false; } |