mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-27 11:20:26 +01:00
Fix crash if add_entity fails (#88)
This commit is contained in:
parent
d90c17edee
commit
e7cba4071b
@ -163,11 +163,15 @@ local entitydef_default = {
|
|||||||
if not is_active(entity_pos) then
|
if not is_active(entity_pos) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local ent = minetest.add_entity(entity_pos, entity.name):get_luaentity()
|
local object = minetest.add_entity(entity_pos, entity.name)
|
||||||
|
if not object then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local ent = object:get_luaentity()
|
||||||
ent:from_data(entity.data)
|
ent:from_data(entity.data)
|
||||||
ent.parent_id = self._id
|
ent.parent_id = self._id
|
||||||
ent.attached_id = index
|
ent.attached_id = index
|
||||||
entity.entity = ent.object
|
entity.entity = object
|
||||||
local master = self._attached_entities_master
|
local master = self._attached_entities_master
|
||||||
if master then
|
if master then
|
||||||
self:_attach(index, master)
|
self:_attach(index, master)
|
||||||
|
Loading…
Reference in New Issue
Block a user