Fix #10349 game crashing if dropped an item with undefined light_source (#10351)

This commit is contained in:
Pierre-Yves Rollo 2020-08-30 15:34:28 +02:00 committed by Nils Dagsson Moskopp
parent 32c85cf41b
commit eae3db8399
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,8 @@ core.register_entity(":__builtin:item", {
local count = math.min(stack:get_count(), max_count)
local size = 0.2 + 0.1 * (count / max_count) ^ (1 / 3)
local def = core.registered_items[itemname]
local glow = def and math.floor(def.light_source / 2 + 0.5)
local glow = def and def.light_source and
math.floor(def.light_source / 2 + 0.5)
self.object:set_properties({
is_visible = true,