Default: Prevent possible nil-crash on invalid book metadata

This commit is contained in:
Tim 2016-10-04 19:49:06 +02:00 committed by paramat
parent 32f7051eb8
commit 1799754a8f
1 changed files with 3 additions and 1 deletions

View File

@ -105,7 +105,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
elseif fields.book_next or fields.book_prev then
local data = minetest.deserialize(stack:get_metadata())
if not data.page then return end
if not data or not data.page then
return
end
if fields.book_next then
data.page = data.page + 1