diff --git a/mods/cozylights/init.lua b/mods/cozylights/init.lua index 5d311c10..e73c8b40 100644 --- a/mods/cozylights/init.lua +++ b/mods/cozylights/init.lua @@ -562,12 +562,14 @@ minetest.register_globalstep(function(dtime) for _,cozyplayer in pairs(cozylights.cozyplayers) do local t = os.clock() local player = minetest.get_player_by_name(cozyplayer.name) - local pos = vector.round(player:getpos()) - pos.y = pos.y + 1 - local wield_name = player:get_wielded_item():get_name() - --todo: checking against a string is expensive, what do - if wield_name == "cozylights:light_brush" then - on_brush_hold(player,cozyplayer,pos,t) + if not player == nil then + local pos = vector.round(player:getpos()) + pos.y = pos.y + 1 + local wield_name = player:get_wielded_item():get_name() + --todo: checking against a string is expensive, what do + if wield_name == "cozylights:light_brush" then + on_brush_hold(player,cozyplayer,pos,t) + end end end end