"restore credit best" crashes recipe during band.SetStrength
|Opened on:||Thursday, December 21, 2017 - 01:17|
|Last modified:||Monday, January 15, 2018 - 07:45|
Accidentally using the keyboard shortcut lowercase "i" when a recipe happens to be running band.SetStrength can cause the recipe to terminate with an index out of bounds error.
I suspect this happens if the best position doesn't have any bands, so the band index passed to band.SetStrength is no longer valid.
The undo shortcuts like "i" should be disabled while a recipe is running.
Not sure, but I wonder if this problem may be related to the fact that you can add, change, or delete bands while a recipe is running. It's often handy to be able to play with bands while wiggle is running, but it probably makes sense to disable that ability while a recipe is running.
The recipe bandfun 1.0 can be used to recreate this problem. The recipe draws a lot of bands, and sets the strength of many of them. Hitting "i" during the early going usually terminates the recipe. (The band.Add calls in the recipe are wrapped in pcall calls, but the band.SetStrength calls are not.)
I assume that other band functions which use a band index might show the same behavior.
Not directly related, but band.SetStrength seems relatively slow. The first part of bandfun 1.0 draws a relatively small number of long, strong bands, and seems quite slow. The second part draws many more bands without changing their strength, and seems much faster.