Books: Add nil value checks to the book formspec handler
authorred-001 <red-001@outlook.ie>
Tue, 13 Jun 2017 22:59:25 +0000 (23:59 +0100)
committersfan5 <sfan5@live.de>
Sun, 19 Nov 2017 21:52:00 +0000 (22:52 +0100)
mods/default/craftitems.lua

index 33cdd5f664eb4d8e59f75f6d89c0b6cadbbc7b60..1500a3461a0b2cf6e52478465635c63d5a0b4194 100644 (file)
@@ -80,7 +80,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
        local inv = player:get_inventory()
        local stack = player:get_wielded_item()
 
-       if fields.save and fields.title ~= "" and fields.text ~= "" then
+       if fields.save and fields.title and fields.text
+                       and fields.title ~= "" and fields.text ~= "" then
                local new_stack, data
                if stack:get_name() ~= "default:book_written" then
                        local count = stack:get_count()