Screwdriver: Fix crash
authortenplus1 <tenplus1@users.noreply.github.com>
Wed, 1 Mar 2017 16:57:27 +0000 (16:57 +0000)
committerparamat <mat.gregory@virginmedia.com>
Tue, 7 Mar 2017 06:37:33 +0000 (06:37 +0000)
If 'node_box' is nil 'node_box.type' causes a crash.

mods/screwdriver/init.lua

index d898cb9f038608f4ddac7a70599d4d302d324a39..383d29cd175206f4ad9aedcbc73e55def458744d 100644 (file)
@@ -67,7 +67,7 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
                if not ndef or not ndef.paramtype2 == "facedir" or
                                ndef.on_rotate == false or
                                (ndef.drawtype == "nodebox" and
-                               not ndef.node_box.type == "fixed") or
+                               (ndef.node_box and ndef.node_box.type ~= "fixed")) or
                                node.param2 == nil then
                        return
                end