From f9511d38fe6e39f834852e26676e2873aeeef0bd Mon Sep 17 00:00:00 2001 From: Coder12a <38924418+Coder12a@users.noreply.github.com> Date: Thu, 6 Aug 2020 15:36:12 -0500 Subject: [PATCH] Fix: crash in remove_hits func --- README.md | 2 +- init.lua | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b24a6bf..58e40d2 100644 --- a/README.md +++ b/README.md @@ -316,7 +316,7 @@ Used to multiply wear from any tool blocking or shielding. pvp_revamped.block_wear_mul = 9000 ``` -#### Effects +#### effects Value is used to decrease the chance of disarming another player. ``` lua pvp_revamped.disarm_chance_mul = 2 diff --git a/init.lua b/init.lua index e6a2866..f34cc4a 100644 --- a/init.lua +++ b/init.lua @@ -806,14 +806,16 @@ if sscsm then local function remove_hits(name) local hit_data = get_player_data(name).hit - for i = #hit_data, 1, -1 do - local data = hit_data[i] + if hit_data then + for i = #hit_data, 1, -1 do + local data = hit_data[i] - if not data.resolved then - local count = #hit_data - - hit_data[i] = hit_data[count] - hit_data[count] = nil + if not data.resolved then + local count = #hit_data + + hit_data[i] = hit_data[count] + hit_data[count] = nil + end end end end