Keyboard events on an empty Listview crash my project

Hi there,

I am writing a camera script that listens to several keys. When I press LeftArrow then PageUp the project crashes with this error:

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Collections.Generic.List`1[T].System.Collections.IList.get_Item (System.Int32 index) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEngine.UIElements.ListView.AddToSelectionWithoutValidation (System.Int32 index) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/Controls/ListView.cs:1203)

Actually it turns out that I use a Listview that is empty at the time of the test. I never meant to use keyboard events on this listview, it is only for displaying info. Oddly enough, if I press RightArrow then PageUp it won’t crash at all.

I guess the two ways for me to fix this, is to either remove the focus on the list or disable the keyboard events on it but I don’t know how to do that since I am still new to Unity.

Hello! Can you submit a bug report though Help > Report a Bug with a simple project to show the problem? This is something we’d want to check on and fix! Thanks

Ok, I will. Solved the issue by setting focusable to false if anyone wonders.