Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Default: Prevent possible nil-crash on invalid book metadata
  • Loading branch information
t4im authored and paramat committed Oct 5, 2016
1 parent 32f7051 commit 1799754
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mods/default/craftitems.lua
Expand Up @@ -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
Expand Down

0 comments on commit 1799754

Please sign in to comment.