1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-23 15:20:19 +01:00

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

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 elseif fields.book_next or fields.book_prev then
local data = minetest.deserialize(stack:get_metadata()) 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 if fields.book_next then
data.page = data.page + 1 data.page = data.page + 1