Skip to content
Permalink
Browse files

Fix NPE in CheckListView (#1222)

  • Loading branch information
samhutchins authored and abhinayagarwal committed Dec 18, 2019
1 parent 989f48e commit 784564f5e078e0de20a306a46de7917b146e98eb
Showing with 6 additions and 2 deletions.
  1. +6 −2 controlsfx/src/main/java/org/controlsfx/control/CheckListView.java
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2013, 2018 ControlsFX
* Copyright (c) 2013, 2019 ControlsFX
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,7 @@
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.scene.Parent;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ListView;
import javafx.scene.control.cell.CheckBoxListCell;
@@ -124,7 +125,10 @@ public CheckListView(ObservableList<T> items) {
final CheckBoxListCell<T> checkBoxListCell = new CheckBoxListCell<>(item -> getItemBooleanProperty(item));
checkBoxListCell.focusedProperty().addListener((o, ov, nv) -> {
if (nv) {
checkBoxListCell.getParent().requestFocus();
final Parent parent = checkBoxListCell.getParent();
if (parent != null) {
parent.requestFocus();
}
}
});
return checkBoxListCell;

0 comments on commit 784564f

Please sign in to comment.
You can’t perform that action at this time.