Make error handling safe in case pos is missing

This commit is contained in:
ancientmarinerdev 2023-03-14 15:19:39 +00:00 committed by Gitea
parent 97091de67f
commit be269b2034
1 changed files with 5 additions and 3 deletions

View File

@ -510,9 +510,11 @@ function mob_class:on_step(dtime)
else else
warn_user_error () warn_user_error ()
local pos = self.object:get_pos() local pos = self.object:get_pos()
local node = minetest.get_node(pos) if pos then
if node and node.name == "ignore" then local node = minetest.get_node(pos)
minetest.log("warning", "Pos is ignored: " .. dump(pos)) if node and node.name == "ignore" then
minetest.log("warning", "Pos is ignored: " .. dump(pos))
end
end end
log_error (dump(retVal), dump(pos), dump(self)) log_error (dump(retVal), dump(pos), dump(self))
end end