Error when you don't nil check activeRegions[i] in the CustomGrow function
Lardeck opened this issue · 7 comments
Describe the bug
Do you have an error log of what happened?
To Reproduce
- Create a Dynamic Group
- Create any Aura inside that Dynamic Group
- Try to use this CustomGrow function
function(newPositions, activeRegions) local mid = #activeRegions / 2 for i = 1, 4 do newPositions[i] = { 40 * (i - mid), 0.5 * (i - mid)^2 } end end
- Can't close the Lua editor by saving the code. You have to use the "Cancel" button. You can save your code by using Ctrl+S but that also won't close the Lua editor.
- The "/wa" in the EditBox doesn't disappear and somtimes you have to press enter several times until the WA Options Frame shows up.
Screenshots
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?
2.14.1
Was it working in a previous version? If yes, which was the last good one?
Yes in 2.13.4
Additional context
I know that you can avoid this error by nil checking activeRegions[i] and at first i wasn't sure if i should report this as a bug but i thought that it can cause some errors when people don't update their auras that are not "well written". I also apologize for my very bad english :( .
!vBvBZjUnq4FmD6m315oW4aD61z6hietdz4acYCPVmvXcBzhD1wYJKCasNZ)27kj7ab4UE9BTdzaR1R2D1Z(Spk4E4qmQaJsWifg53Px)o9mRaR7MNMQOA8mpm6rQuXeC8m4LsAg8y4Usk44ooPGfNjfvLyeHZkiAJFMGsy2F1wh5cUX9kP9937mQOXcEIcRHh1eP(R39ugNPE4R2Fyh5ScgCwgGrvm4WMC7nF8MHPxx8lZalYCm6bTUu9JD7UHKj6WeDfR(1R6p4dVlSlCMjY4PuEM(b8Sl(EapIRuArXplfBGAPIhBY6R40nlekM5z1BQJiG1hPlTOL6113uh5(KlIj51rfSK6OFQo6BEHF1rDRJ837CQqwhXSo2dIz)6OeX(32(5Wm)7S)W6(FDQBTF67vh9D1rVcI7BTfYRFZN3zVodo276p5FQ)FAVjkpP(g4lazv0PwGFngT9a(0AHmHkdsYG2uV6OfST08w(d14SQADdIanzO9jjjSkfEMVNb9f8uwM7fkAbqoHO0XRd8kfGTuhnvODCrt(mT8qQshiLcPnaaHJRhdyVz9YHxnzfQTSqSNGq4Jrz2(7OvOW5VhIbxtLCs(hANf89B3HPIjwsGPCbpz6MQRHwFiL1shD7Bc3cigcgp(bHCHascKXGzHblbJvAW48s9ECWTVwKSVPgzj3XsmmZbUvUjZLxbzxajVz2aQKSmOsTOpj(ptKIYrIC40hAkaZF(2VVW(DFWXodmzmwKxvWrLKyhUAMPyNurhgkpBO8SHYZgQE7D8YMCJrxMZE6jIeMccfICndmPfXpR08dE2En0c2N7CbXknfNtuwKUOc2ylMQkPXNA00mp2iqlV3fJ1MLKCwgFpSRLmduPChhyVv8gtUt8(fMuMNpjPbkCYoeqfY3SjGeGkZj7m0t6JutN9AkjhAvg6T1YcjnLTfJqlcMoDVzuvQ189JgIcVhfoCjKlqPL2KOe6AWdxJ(6GPlgVAQ9GzNhYtpMgz5wJLW(DBbnAzqaO7LAmbhhIMyHxLdO9nX5rWsFFt)(zy4Wleev6CMHxnFv40jZcE5veXFrILLn8zlQ)zXyN4BiDREvzIrVav187HxnPH3)F7RKsfqN2Q10Z)fnUlNhAvCoROWhHtplDhgnnyCyZTz3USC07(nVvSnemAdmNDNKaJt398tNv76mYlhZisykddo0ILF75NqpuxhcPWG3Xojj0qyTt9DgDtD0fNkFCS(9r6(gmcJglzpvhDBfjXuzGGr4)NNsrUB8dDf47fjad4T98S)xkFzbUZPLDovplDClT9IbBB6F39thCfRDTzqCcCLYZdIGr8Fp
Yeah of course. Oops^^.
20x WeakAuras\RegionTypes\DynamicGroup.lua:1052: table index is nil
WeakAuras\RegionTypes\DynamicGroup.lua:1052: in function DoPositionChildren' WeakAuras\RegionTypes\DynamicGroup.lua:935: in function
PositionChildren'
WeakAuras\RegionTypes\DynamicGroup.lua:917: in function SortUpdatedChildren' WeakAuras\RegionTypes\DynamicGroup.lua:736: in function
Resume'
WeakAuras\WeakAuras-2.14.1.lua:5569: in function <WeakAuras\WeakAuras.lua:5528>
WeakAuras\WeakAuras-2.14.1.lua:5645: in function `UpdatedTriggerState'
WeakAuras\BuffTrigger2.lua:1254: in function <WeakAuras\BuffTrigger2.lua:1246>
WeakAuras\BuffTrigger2.lua:1537: in function <WeakAuras\BuffTrigger2.lua:1530>
Locals:
self = {
0 =
controlledChildren =
}
xOffset = 0
SortUpdatedChildren = defined @WeakAuras\RegionTypes\DynamicGroup.lua:880
Expand = defined @WeakAuras\RegionTypes\RegionPrototype.lua:733
yOffset = 0
anchorPoint = "CENTER"
SetOffset = defined @WeakAuras\RegionTypes\RegionPrototype.lua:278
DoPositionChildrenPerFrame = defined @WeakAuras\RegionTypes\DynamicGroup.lua:945
updatedChildren =
}
sortFunc = defined @WeakAuras\RegionTypes\DynamicGroup.lua:152
SendChat = defined @WeakAuras\RegionTypes\RegionPrototype.lua:233
controlPoints =
}
OptionsClosed = defined @WeakAuras\RegionTypes\RegionPrototype.lua:595
suspended = 0
cloneId = ""
regionType = "dynamicgroup"
GetRegionAlpha = defined @WeakAuras\RegionTypes\RegionPrototype.lua:321
relativePoint = "CENTER"
SoundPlay = defined @WeakAuras\RegionTypes\RegionPrototype.lua:215
sortedChildren =
}
UpdateRegionHasTimerTick = defined @WeakAuras\RegionTypes\RegionPrototype.lua:338
SetXOffset = defined @WeakAuras\RegionTypes\RegionPrototype.lua:287
Collapse = defined @WeakAuras\RegionTypes\RegionPrototype.lua:730
RealClearAllPoints = defined =[C]:-1
RunCode = defined @WeakAuras\RegionTypes\RegionPrototype.lua:240
ActivateChild = defined @WeakAuras\RegionTypes\DynamicGroup.lua:840
GetYOffset = defined @WeakAuras\RegionTypes\RegionPrototype.lua:299
SetAnimAlpha = defined @WeakAuras\RegionTypes\RegionPrototype.lua:325
growFunc = defined @WeakAuras\RegionTypes\DynamicGroup.lua:655
PositionChildren = defined @WeakAuras\RegionTypes\DynamicGroup.lua:926
needToSort = false
GetXOffset = defined @WeakAuras\RegionTypes\RegionPrototype.lua:295
SetYOffset = defined @WeakAuras\RegionTypes\RegionPrototype.lua:291
Resize = defined @WeakAuras\RegionTypes\DynamicGroup.lua:1068
needToReload = false
needToPosition = false
SetAnchor = defined @WeakAuras\RegionTypes\RegionPrototype.lua:266
RemoveChild = defined @WeakAuras\RegionTypes\DynamicGroup.lua:858
SetRegionAlpha = defined @WeakAuras\RegionTypes\RegionPrototype.lua:312
DeactivateChild = defined @WeakAuras\RegionTypes\DynamicGroup.lua:868
AddChild = defined @WeakAuras\RegionTypes\DynamicGroup.lua:820
subRegions =
}
Suspend = defined @WeakAuras\RegionTypes\DynamicGroup.lua:716
SetOffsetAnim = defined @WeakAuras\RegionTypes\RegionPrototype.lua:303
Resume = defined @WeakAuras\RegionTypes\DynamicGroup.lua:725
needToResize = false
xOffsetAnim = 0
yOffsetAnim = 0
SetTriggerProvidesTimer = defined @WeakAuras\RegionTypes\RegionPrototype.lua:333
SoundStop = defined @WeakAuras\RegionTypes\RegionPrototype.lua:170
ClearAllPoints = defined @WeakAuras\RegionTypes\RegionPrototype.lua:385
relativeTo = WeakAurasFrame {
}
id = "TestError"
ResetPosition = defined @WeakAuras\RegionTypes\RegionPrototype.lua:260
IsSuspended = defined @WeakAuras\RegionTypes\DynamicGroup.lua:712
SoundRepeatStop = defined @WeakAuras\RegionTypes\RegionPrototype.lua:161
UpdateTimerTick = defined @WeakAuras\RegionTypes\RegionPrototype.lua:355
ReloadControlledChildren
Great, thanks. @mrbuds you touched this last, so you get to fix this.
When you open WA this error also shows up.
1x WeakAuras\RegionTypes\DynamicGroup.lua:1052: table index is nil
WeakAuras\RegionTypes\DynamicGroup.lua:1052: in function DoPositionChildren' WeakAuras\RegionTypes\DynamicGroup.lua:935: in function
PositionChildren'
WeakAuras\RegionTypes\DynamicGroup.lua:917: in function SortUpdatedChildren' WeakAuras\RegionTypes\DynamicGroup.lua:736: in function
Resume'
WeakAuras\WeakAuras-2.14.1.lua:1739: in function `ResumeAllDynamicGroups'
WeakAurasOptions\WeakAurasOptions-2.14.1.lua:1623: in function <WeakAurasOptions\WeakAurasOptions.lua:1580>
Its at the exact same line but maybe its helpful.
Your function is returning wrong data and it's fine that it make errors to let you know about it, i'll see if error handler can be improved.
fix for your function
function(newPositions, activeRegions)
local mid = #activeRegions / 2
local max = math.min(#activeRegions, 4)
for i = 1, max do
newPositions[i] = { 40 * (i - mid), 0.5 * (i - mid)^2 }
end
end
I know its wrong. I copied and changed the example on purpose.
I know that you can avoid this error by nil checking activeRegions[i] and at first i wasn't sure if i should report this as a bug but i thought that it can cause some errors when people don't update their auras that are not "well written".
The real problem is that you can't close any lua editor if one aura is causing that error. Thought that might be enough for a bug report 😢 .