Skip to content

Commit

Permalink
potential nil fix for damaging item with 0 hitpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
bmos committed Apr 27, 2021
1 parent 2160cfb commit d143a3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/broken_itemdurability.lua
Expand Up @@ -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)
Expand Down

0 comments on commit d143a3d

Please sign in to comment.