Skip to content

Commit 60391d1

Browse files
committed
Protect against 0 total attribute edge case
1 parent 3fc2659 commit 60391d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Classes/PassiveSpec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,7 @@ function PassiveSpecClass:GetAutoAttribute(cachedPlayerAttr, cachedPathAttrResul
22052205
end
22062206
end
22072207

2208-
playerAttr.sumTotal = playerAttr.dex.total + playerAttr.int.total + playerAttr.str.total
2208+
playerAttr.sumTotal = m_max(1, playerAttr.dex.total + playerAttr.int.total + playerAttr.str.total ) -- use m_max to protect against division by 0 (e.g. in "Omniscience"-like scenarios)
22092209
playerAttr.dex.ratio = playerAttr.dex.total / playerAttr.sumTotal
22102210
playerAttr.int.ratio = playerAttr.int.total / playerAttr.sumTotal
22112211
playerAttr.str.ratio = playerAttr.str.total / playerAttr.sumTotal

0 commit comments

Comments
 (0)