Fix facedir > 23 causes segfault in client
authorCraig Robbins <kde.psych@gmail.com>
Fri, 9 Jan 2015 05:42:03 +0000 (15:42 +1000)
committerCraig Robbins <kde.psych@gmail.com>
Fri, 9 Jan 2015 05:42:03 +0000 (15:42 +1000)
See issue #2017
Applied kahrl's gist

src/mapnode.cpp

index 3940c58679f1422384be1b175ce7371f084762c7..056b940548240b9d869b02f142fa3b7973ed949e 100644 (file)
@@ -119,7 +119,7 @@ u8 MapNode::getFaceDir(INodeDefManager *nodemgr) const
 {
        const ContentFeatures &f = nodemgr->get(*this);
        if(f.param_type_2 == CPT2_FACEDIR)
-               return getParam2() & 0x1F;
+               return (getParam2() & 0x1F) % 24;
        return 0;
 }