WeakAuras

WeakAuras

206M Downloads

Custom grow error if first position is nil

Vardex opened this issue ยท 1 comments

commented

Describe the bug

When using custom grow setting a position to nil hide it, it work well except in a specific case when the first position of the table is nil.

Do you have an error log of what happened?

100x WeakAuras\RegionTypes\DynamicGroup.lua:1052: attempt to index local 'pos' (a number value)
[string "@WeakAuras\RegionTypes\DynamicGroup.lua"]:1052: in function `DoPositionChildrenPerFrame'
[string "@WeakAuras\RegionTypes\DynamicGroup.lua"]:1177: in function `DoPositionChildren'
[string "@WeakAuras\RegionTypes\DynamicGroup.lua"]:1039: in function `PositionChildren'
[string "@WeakAuras\RegionTypes\DynamicGroup.lua"]:1020: in function `SortUpdatedChildren'
[string "@WeakAuras\RegionTypes\DynamicGroup.lua"]:978: in function `DeactivateChild'
[string "@WeakAuras\RegionTypes\RegionPrototype.lua"]:768: in function <...aceWeakAuras\RegionTypes\RegionPrototype.lua:757>
[string "@WeakAuras\RegionTypes\RegionPrototype.lua"]:794: in function `Collapse'
[string "@WeakAuras\WeakAuras-3.0.0-alpha6.lua"]:1185: in function `Pause'
[string "@WeakAurasOptions\WeakAurasOptions-3.0.0-alpha6.lua"]:494: in function `ShowOptions'
[string "@WeakAurasOptions\WeakAurasOptions-3.0.0-alpha6.lua"]:478: in function `ToggleOptions'
[string "@WeakAuras\WeakAuras-3.0.0-alpha6.lua"]:87: in function `OpenOptions'
[string "@WeakAuras\WeakAuras-3.0.0-alpha6.lua"]:888: in function `OnClick'
[string "@WeakAuras\Libs\LibDBIcon-1.0\LibDBIcon-1.0-43.lua"]:144: in function <WeakAuras\Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua:142>

To Reproduce

Steps to reproduce the behavior:

  1. Create a new dynamic group
  2. Create 2 new aura in dynamic group
  3. Set function below as custom grow
function(newPositions, activeRegions)
    newPositions[2] = {0, 0}
end

Did you try having WeakAuras as the only enabled addon and everything else (especially something like ElvUI) disabled?
Yes.

Which version of WeakAuras are you using?
3.0.0-alpha6

Are you on World of Warcraft Classic or Retail?

  • Classic
  • Retail
  • Beta

Was it working in a previous version? If yes, which was the last good one?
I don't know.

Additional Info

I believe the bug is because of this:

if #newPositions > 0 then

Getting the length of a table doesn't work when it contain nil in it, in that case with the first element being nil it will return 0 which will cause an error with next DoPositionChildrenPerFrame call.

commented

That's not a bug though. You are supposed to either give back a array or a table indexed by the regionData. I've made the code more resilent against that in #2374. But it doesn't do what you want.