From d143a3da9ce4dafb58a7b3705b7e6fa7e6b8471c Mon Sep 17 00:00:00 2001 From: Wil Thieme Date: Tue, 27 Apr 2021 07:41:05 -0400 Subject: [PATCH] potential nil fix for damaging item with 0 hitpoints --- scripts/broken_itemdurability.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/broken_itemdurability.lua b/scripts/broken_itemdurability.lua index 1fc7e86..5573982 100644 --- a/scripts/broken_itemdurability.lua +++ b/scripts/broken_itemdurability.lua @@ -79,7 +79,7 @@ local function brokenItemCost(nodeItem, bIsBroken) local sItemCostSeperatorChar = string.match(sItemCostBak, '[%D]') local nItemCostSeperator = string.find(sItemCostBak, sItemCostSeperatorChar) - local nItemCostNew = tonumber(string.sub(sItemCostBak, 1, nItemCostSeperator - 1)) + local nItemCostNew = tonumber(string.sub(sItemCostBak, 1, nItemCostSeperator - 1)) or 0 local sItemCostUnit = string.sub(sItemCostBak, nItemCostSeperator) DB.setValue(nodeItem, 'cost', 'string', ItemDurabilityLib.round(nItemCostNew * .75, nil) .. ' ' .. sItemCostUnit)