Division by zero error causes trigger state to remain frozen until reloaded
bartuszekj opened this issue ยท 3 comments
Describe the bug
A division by zero condition inside the "Duration Info" block causes the value stored in aura_env.states[i].value not to be properly updated until relog, /reload, or /wa (which forces WA to be reloaded).
To Reproduce
Steps to reproduce the behavior:
- Download the WeakAura to demonstrate the problem: https://wago.io/5PKemwHHU/1.0.4 (ensure version 1.0.4 is used)
- Perform any action that will start tracking alternate power (e.g. enter Stortmstout Brewery and kill the first hozen, enter the chamber of heart and the staging area of the horrific vision of N'Zoth).
- Notice the percentage value indicator on the weakaura is fixed to "-nan(ind)", regardless of the actual duration value calculated by the trigger.
- Execute /wa or /reload, and observe the problem go away, which indicates the aura_env.states[i].value is being updated correctly going forward
- The https://wago.io/5PKemwHHU/1.0.5 version of the WeakAura addresses the division by zero problem. Performing the same steps as outlined above does not appear to freeze the aura_env.states[i].value value until /reload or /wa.
This indicates that division by error in custom trigger duration info code causes breakdown in continuous update of aura_env.states[i].value
Screenshots
https://imgur.com/a/3JOf4bP
Did you try having WeakAuras as the only enabled addon and everything else (especially something like ElvUI) disabled?
No, but it doesn't appear to be relevant in this scenario.
Which version of WeakAuras are you using?
3.0.4
Are you on World of Warcraft Classic or Retail?
- Classic
- Retail
Was it working in a previous version? If yes, which was the last good one?
This WeakAura was working fine in 2.x and this behavior was not present at that time.
That's a bug in WoW, that I don't want to workaround:
Running:
/dump 0/0 == 100
Shows that the first value is equal to the second, which is a obvious incorrect.
In Computer Science terms the first value is NaN, which is supposed to be unequal to every number.
Checking for NaN is not something I want to add to every code path, where we compare values. That's far too many places.
Is NaN in wow equal to any other number, not only 100? Also, was that not the case in 8.3 or has the WA engine changed the way this condition is handled?
Yes it's equal to any number. I don't know whether that has changed, though I don't think it has. So, yes this should be due to a change in WA's handling of NaN.
As far as I'm concerned returning NaN from a duration function is a error in the duration function, as we only check if the value is different from the previous value and don't want to explicitly check for NaN there.