Books: Add nil value checks to the book formspec handler

This commit is contained in:
red-001 2017-06-13 23:59:25 +01:00 committed by sfan5
parent a56274c230
commit 706844e8bf
1 changed files with 2 additions and 1 deletions

View File

@ -80,7 +80,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local inv = player:get_inventory() local inv = player:get_inventory()
local stack = player:get_wielded_item() 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 local new_stack, data
if stack:get_name() ~= "default:book_written" then if stack:get_name() ~= "default:book_written" then
local count = stack:get_count() local count = stack:get_count()