From 9b0ff171018383e4870087da98f7f64dab2c1353 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sat, 11 Apr 2020 17:51:15 +0100 Subject: [PATCH] add sanity check to do_punch --- api.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api.lua b/api.lua index e38c04b..4778d5c 100644 --- a/api.lua +++ b/api.lua @@ -2783,6 +2783,10 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir) and tflp >= punch_interval then local v = self.object:get_velocity() + + -- sanity check + if not v then return end + local kb = damage or 1 local up = 2