On Tue, 6 Jul 2021 20:20:23 GMT, Marius Hanl <mh...@openjdk.org> wrote:
>> This PR fixes 2 NPEs in Choice-and ComboBox, when the selection model is >> null. >> >> ChoiceBox: >> - Null check in **valueProperty()** listener >> >> ComboBox: >> - Null check in **valueProperty()** listener >> - Null check in **ComboBoxListViewSkin#updateValue()** >> >> The tests checks, that no NPE is printed to the console. They also checks, >> that the set value is still displayed (either in the ComboBox button cell or >> the ChoiceBox display label) > > Marius Hanl has updated the pull request incrementally with one additional > commit since the last revision: > > Added another cbx test + cleaned up exception handler + let the exception > bubble up instead of try-catch modules/javafx.controls/src/main/java/javafx/scene/control/ComboBox.java line 244: > 242: if (getItems() == null) return; > 243: SelectionModel<T> sm = getSelectionModel(); > 244: if (sm == null) return; Do we need similar null check in editableProperty() listener below? modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxListViewSkin.java line 401: > 399: private void updateValue() { > 400: SingleSelectionModel<T> comboBoxSM = > comboBox.getSelectionModel(); > 401: if (comboBoxSM == null) { Similar null check can be added to layoutChildren() method as well. ------------- PR: https://git.openjdk.java.net/jfx/pull/557