mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-27 10:29:34 +01:00
Fix undefined luaentity crash.
* Add nil check to get_luaentity() access. * Cache get_luaentity() call in local var.
This commit is contained in:
parent
3dd4eec4e8
commit
46ee5aaa59
2 changed files with 4 additions and 4 deletions
|
@ -222,8 +222,8 @@ local collision = function(self)
|
|||
|
||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||
|
||||
if object:is_player()
|
||||
or (object:get_luaentity()._cmi_is_mob == true and object ~= self.object) then
|
||||
local ent = object:get_luaentity()
|
||||
if object:is_player() or (ent and ent._cmi_is_mob and object ~= self.object) then
|
||||
|
||||
local pos2 = object:get_pos()
|
||||
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
||||
|
|
|
@ -35,8 +35,8 @@ local function player_collision(player)
|
|||
|
||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||
|
||||
if object and (object:is_player()
|
||||
or (object:get_luaentity()._cmi_is_mob == true and object ~= player)) then
|
||||
local ent = object:get_luaentity()
|
||||
if (object:is_player() or (ent and ent._cmi_is_mob and object ~= player)) then
|
||||
|
||||
local pos2 = object:get_pos()
|
||||
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
||||
|
|
Loading…
Reference in a new issue