forked from VoxeLibre/VoxeLibre
Add defensive check (#4437)
This fixes #4436 and possible other unnoticed crashes by adding a defensive check. Reviewed-on: VoxeLibre/VoxeLibre#4437 Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com> Co-authored-by: the-real-herowl <wiktor_t-i@proton.me> Co-committed-by: the-real-herowl <wiktor_t-i@proton.me>
This commit is contained in:
parent
35e14dd415
commit
72435933e4
|
@ -802,7 +802,9 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- alert others to the attack
|
-- alert others to the attack
|
||||||
local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range)
|
local alert_pos = hitter:get_pos()
|
||||||
|
if alert_pos then
|
||||||
|
local objs = minetest.get_objects_inside_radius(alert_pos, self.view_range)
|
||||||
local obj = nil
|
local obj = nil
|
||||||
|
|
||||||
for n = 1, #objs do
|
for n = 1, #objs do
|
||||||
|
@ -833,6 +835,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function mob_class:check_aggro(dtime)
|
function mob_class:check_aggro(dtime)
|
||||||
|
|
Loading…
Reference in New Issue