Fix crashing if null itemstack enchant when player is hacking

This commit is contained in:
jordan4ibanez 2021-04-29 01:32:57 -04:00
parent e0c94ccb8a
commit cf46f0d8b8

View File

@ -6,6 +6,9 @@ function mcl_enchanting.is_book(itemname)
end
function mcl_enchanting.get_enchantments(itemstack)
if not itemstack then
return({})
end
return minetest.deserialize(itemstack:get_meta():get_string("mcl_enchanting:enchantments")) or {}
end