summaryrefslogtreecommitdiff
path: root/builtin/game
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/game')
-rw-r--r--builtin/game/item.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index c9ccb8801..5a83eafd2 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -499,11 +499,12 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
return result
end
end
+ -- read definition before potentially emptying the stack
+ local def = itemstack:get_definition()
if itemstack:take_item():is_empty() then
return itemstack
end
- local def = itemstack:get_definition()
if def and def.sound and def.sound.eat then
core.sound_play(def.sound.eat, {
pos = user:get_pos(),