diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index 4afa91983b19917b8f2db9d7888f7838ce45dc52..fe9686f0d3f0fe07e583164cdeb07a012029fd71 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -163,6 +163,9 @@ void MapNode::rotateAlongYAxis(INodeDefManager *nodemgr, Rotation rot) {
 	ContentParamType2 cpt2 = nodemgr->get(*this).param_type_2;
 
 	if (cpt2 == CPT2_FACEDIR) {
+		if (param2 >= 4)
+			return;
+
 		u8 newrot = param2 & 3;
 		param2 &= ~3;
 		param2 |= (newrot + rot) & 3;