RobustToolbox icon indicating copy to clipboard operation
RobustToolbox copied to clipboard

TabContainer CurrentTab is not corrected when ChildCount changes which can cause a crash

Open theashtronaut opened this issue 2 years ago • 0 comments

If you have a TabContainer in a UI and change the ChildCount such that the CurrentTab is >= ChildCount, it triggers the exception when you click on any tab.

reproduction: have a UI with multiple tabs select the last tab / highest index tab RemoveAllChildren and add at least 1 child try to click on the child

I encountered this when working on my gas analyzer refactor

I ended up working around it by keeping track of the active tab and preemptively setting it to 0 if that tab would be out of range before calling RemoveAllChildren, but TabContainer should probably resize properly / set current tab when the child count changes if it would encounter that issue when clicking on a tab so that people don't have to work around it.

theashtronaut avatar Sep 02 '22 08:09 theashtronaut