From 0d88b4443f79aeb4c53a17b35ddfea86085f11ef Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Tue, 28 Jul 2015 18:11:51 +0200 Subject: [PATCH] Nil index check - Solves #170 --- mods/throwing/functions.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mods/throwing/functions.lua b/mods/throwing/functions.lua index 2427c898..af10bd26 100755 --- a/mods/throwing/functions.lua +++ b/mods/throwing/functions.lua @@ -33,9 +33,11 @@ function throwing_shoot_arrow (itemstack, player, stiffness, is_cross) else minetest.sound_play("throwing_bow_sound", {pos=playerpos}) end - obj:get_luaentity().player = player - obj:get_luaentity().inventory = player:get_inventory() - obj:get_luaentity().stack = player:get_inventory():get_stack("main", player:get_wield_index()-1) + if obj:get_luaentity() then + obj:get_luaentity().player = player + obj:get_luaentity().inventory = player:get_inventory() + obj:get_luaentity().stack = player:get_inventory():get_stack("main", player:get_wield_index()-1) + end return true end