From 598692cf8c2fcbe94c21ab82ef3432665eb74e76 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 4 Apr 2021 12:10:21 +0200 Subject: [PATCH] Add nil check to prevent crashes with mcl_throwing --- mods/ITEMS/mcl_throwing/register.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_throwing/register.lua b/mods/ITEMS/mcl_throwing/register.lua index 8ef1c73bf..3d8cc94cf 100644 --- a/mods/ITEMS/mcl_throwing/register.lua +++ b/mods/ITEMS/mcl_throwing/register.lua @@ -99,7 +99,7 @@ local snowball_on_step = function(self, dtime) local vel = self.object:get_velocity() local node = minetest.get_node(pos) local def = minetest.registered_nodes[node.name] - + -- Destroy when hitting a solid node if self._lastpos.x~=nil then @@ -203,7 +203,7 @@ local pearl_on_step = function(self, dtime) self.object:remove() -- Activate when hitting a solid node or a plant elseif walkable or nn == "mcl_core:vine" or nn == "mcl_core:deadbush" or minetest.get_item_group(nn, "flower") ~= 0 or minetest.get_item_group(nn, "sapling") ~= 0 or minetest.get_item_group(nn, "plant") ~= 0 or minetest.get_item_group(nn, "mushroom") ~= 0 or not def then - local player = minetest.get_player_by_name(self._thrower) + local player = self._thrower and minetest.get_player_by_name(self._thrower) if player then -- Teleport and hurt player