On Sat, 8 Jan 2022 00:17:36 GMT, Marius Hanl <mh...@openjdk.org> wrote:
> This PR fixes a bunch of NPEs when a null `SelectionModel` or `FocusModel` is > set on a `ListView`. > > The following NPEs are fixed (all are also covered by exactly one test case): > NPEs with null selection model: > - Mouse click on a `ListCell` > - SPACE key press > - KP_UP (arrow up) key press > - HOME key press > - END key press > - BACK_SLASH + CTRL key press > > NPEs with null focus model: > - SPACE key press > - Select an items: getSelectionModel().select(1) > - Clear-Select an item and add one after: > listView.getSelectionModel().clearAndSelect(1); listView.getItems().add("3"); Changes requested by angorya (Author). There is a condition observed while debugging [JDK-8187145](https://bugs.openjdk.org/browse/JDK-8187145), when a non-null selection model is set, the user creates a non-empty selection, then the selection is set to null. The UI still shows selected cells - does the same bug exists in ListView? modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/ListViewBehavior.java line 268: > 266: return; > 267: } > 268: line 281 (below): could sm be null there? ------------- PR: https://git.openjdk.org/jfx/pull/711