StandardListView current_item member allows invalid index #7530
Labels
a:widgets
Implementation of widgets (from std-widgets.slint) and their styles (mF,bS)
bug
Something isn't working
need triaging
Issue that the owner of the area still need to triage
Bug Description
The code below creates a simple
StandardListView
with 3 elements and a button to remove the currently selected element from thatStandardListView
. The element will be removed via the attached Rust code.To reproduce the issue, just select the last element (Green) and click the button. The element will disappear as expected. Since no element is selected anymore, I assumed the value is -1, instead it is still 2. So clicking the button again, will make the application panic.
I understand, that I can reset the value manual to -1 or any other logical value, but I was surprised to find, that this simple setup would allow me to panic.
Reproducible Code (if applicable)
Environment Details
Product Impact
I'm building an open-source application with slint, it is my first slint project. This issue is a minor one, because there are simple workarounds.
The text was updated successfully, but these errors were encountered: