raethkcj / RatingBuster

An item comparison tool for WoW Classic.
GNU General Public License v2.0
58 stars 14 forks source link

[Bug]: Calculation fails for comparing Ashen Rings due to StatLogic - "attempt to preform arithmetic on a nil value" #174

Closed glajchs closed 9 months ago

glajchs commented 9 months ago

Describe the bug

Wrath of the lich king version - 1.13.7

Stack trace below.

I was able to patch this up to not fail locally by changing line 1535 of StatLogic.lua from: statTable[id] = (statTable[id] or 0) + tonumber(value) to: statTable[id] = (statTable[id] or 0) + (tonumber(value) or 0)

I didn't dig deeper into what further up the call stack might be the issue. I did, with some debug output, figure out that the value that's being parsed is false, so indeed not a number.

This happened when I specifically moused over the item "Ashen Band of Endless Courage" (tanking ring)

This is with the latest Jan 18/2024 patch release.

The call stack this seems to happen in is: AddStat() ParseMatch() (in the section that says: -- PreScan for special cases, that will fit wrongly into DeepScan -- PreScan also has exclude patterns) GetSum() StatSummary() (in build summary table section)

Time: Sun Jan 21 16:44:30 2024
Count: 196
Stack: Interface/AddOns/StatLogic/StatLogic.lua:1535: attempt to perform arithmetic on a nil value
[string "=[C]"]: ?
[string "@Interface/AddOns/StatLogic/StatLogic.lua"]:1535: in function <Interface/AddOns/StatLogic/StatLogic.lua:1525>
[string "@Interface/AddOns/StatLogic/StatLogic.lua"]:1560: in function <Interface/AddOns/StatLogic/StatLogic.lua:1539>
[string "@Interface/AddOns/StatLogic/StatLogic.lua"]:1727: in function `GetSum'
[string "@Interface/AddOns/RatingBuster/RatingBuster.lua"]:3351: in function `StatSummary'
[string "@Interface/AddOns/RatingBuster/RatingBuster.lua"]:1775: in function <Interface/AddOns/RatingBuster/RatingBuster.lua:1629>
[string "@Interface/AddOns/RatingBuster/TipHooker.lua"]:8: in function <Interface/AddOns/RatingBuster/TipHooker.lua:6>
[string "@Interface/AddOns/RatingBuster/TipHooker.lua"]:16: in function <Interface/AddOns/RatingBuster/TipHooker.lua:14>
[string "=[C]"]: ?

Locals: (*temporary) = <function> defined =[C]:-1

Addon Source

CurseForge

Version

1.13.7

Locale

English

Talent Specialization

Balance Druid

Race

Night Elf

raethkcj commented 9 months ago

Thank you! I ended up fixing it a little further up since it affected some other obscure cases, but I really appreciate the detailed report.