Timberborn-Modding-Central / TimberAPI

The one and only
https://timberapi.com
GNU Lesser General Public License v2.1
33 stars 17 forks source link

Crash on Shift Scroll with no buildings shown #95

Closed KnatteAnka closed 8 months ago

KnatteAnka commented 9 months ago

New problem noted with tapi to fix for stable release If you scroll on a toolbar with no buildings only submenus it crashes:

Reproduction:

Mods:

Steps:

Error:

v0.5.5.0-4e59a84-xsw
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <cb3602b5bf2148caa08db7780ec02b19>:0)
Timberborn.Common.ReadOnlyList`1[T].get_Item (System.Int32 index) (at <e72b32c80c554ad0b291a8046b9dd76f>:0)
Timberborn.ToolSystem.ToolbarButtonRetriever.TryGetPreviousVisibleButton (System.Collections.Generic.IReadOnlyList`1[T] buttons, Timberborn.ToolSystem.IToolbarButton& previousButton) (at <8608220f7fd6421f80d51e6c557cfbe9>:0)
Timberborn.ToolSystem.ToolButtonService.TryGetPreviousToolButton (Timberborn.ToolSystem.IToolbarButton& toolButton) (at <8608220f7fd6421f80d51e6c557cfbe9>:0)
Timberborn.ToolSystem.ToolSelector.ProcessToolbarInput () (at <8608220f7fd6421f80d51e6c557cfbe9>:0)
Timberborn.ToolSystem.ToolSelector.ProcessInput () (at <8608220f7fd6421f80d51e6c557cfbe9>:0)
Timberborn.InputSystem.InputService.CallInputProcessors () (at <3f98b95327c94694824c1907abb85ac0>:0)
Timberborn.InputSystem.InputService.Update () (at <3f98b95327c94694824c1907abb85ac0>:0)

[Uploading error-report-2024-01-02-16h59m36s.zip…]()

Fix? Disable dunction if no buildings is shown?

KYPremco commented 8 months ago

Solved in next version.