Add nil check for crash prevention

This commit is contained in:
Elias Fleckenstein 2021-04-29 11:17:52 +02:00
parent 33c0aa23c5
commit 199488cc74

View file

@ -532,6 +532,10 @@ function mcl_util.get_object_name(object)
else else
local luaentity = object:get_luaentity() local luaentity = object:get_luaentity()
if not luaentity then
return ""
end
return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name
end end
end end