From 89cbc1deedf203f6f72dd514f12a5d2ac2fd235f Mon Sep 17 00:00:00 2001 From: kay27 Date: Sun, 13 Mar 2022 17:42:58 +0400 Subject: [PATCH] Fix crash in mcl_bows/rocket.lua:41 --- mods/ITEMS/mcl_bows/rocket.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_bows/rocket.lua b/mods/ITEMS/mcl_bows/rocket.lua index 678aba4d4..c6f6351a4 100644 --- a/mods/ITEMS/mcl_bows/rocket.lua +++ b/mods/ITEMS/mcl_bows/rocket.lua @@ -38,11 +38,14 @@ local function damage_explosion(self, damagemulitplier) for _,obj in pairs(objects) do if obj:is_player() then mcl_util.deal_damage(obj, damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos()), {type = "explosion"}) - elseif obj:get_luaentity()._cmi_is_mob then - obj:punch(self.object, 1.0, { - full_punch_interval=1.0, - damage_groups={fleshy=damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos())}, - }, self.object:get_velocity()) + else + local entity = obj:get_luaentity() + if entity and entity._cmi_is_mob then + obj:punch(self.object, 1.0, { + full_punch_interval=1.0, + damage_groups={fleshy=damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos())}, + }, self.object:get_velocity()) + end end end end