Fix server crash when dispensing an unknown item

This works similar to 2aafb2f2d01a6ece9ed4642a7081c53dbf22f773, however it is a cleaner way to do it.
This commit is contained in:
Elias Fleckenstein 2021-07-08 15:31:27 +02:00
parent 8445a9ddec
commit fb01e61946

@ -129,8 +129,13 @@ local dispenserdef = {
dropitem:set_count(1) dropitem:set_count(1)
local stack_id = stacks[r].stackpos local stack_id = stacks[r].stackpos
local stackdef = stack:get_definition() local stackdef = stack:get_definition()
if not stackdef then
return
end
local iname = stack:get_name() local iname = stack:get_name()
local igroups = minetest.registered_items[iname].groups local igroups = stackdef.groups
--[===[ Dispense item ]===] --[===[ Dispense item ]===]