Skip to content

Commit add652b

Browse files
committed
moved selectionLogic to selectionlistener and cathched null
1 parent cce062b commit add652b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/main/java/de/doubleslash/keeptime/view/ManageWorkController.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,16 @@ public Project fromString(final String string) {
222222
@Override
223223
public void changed(final ObservableValue<? extends Project> observable, final Project oldValue,
224224
final Project newValue) {
225+
if (newValue == null) {
226+
return;
227+
}
228+
225229
comboChange = true;
230+
// needed to avoid exception on empty textfield https://bugs.openjdk.java.net/browse/JDK-8081700
231+
Platform.runLater(() -> {
232+
projectComboBox.getEditor().selectAll();
233+
setColor(projectComboBox, newValue.getColor());
234+
});
226235

227236
}
228237
});
@@ -238,12 +247,7 @@ public void changed(final ObservableValue<? extends String> observable, final St
238247
// ignore selectionChanges
239248
if (comboChange) {
240249
comboChange = false;
241-
// needed to avoid exception on empty textfield https://bugs.openjdk.java.net/browse/JDK-8081700
242-
Platform.runLater(() -> {
243-
isValidProject = true;
244-
projectComboBox.getEditor().selectAll();
245-
setColor(projectComboBox, projectComboBox.getValue().getColor());
246-
});
250+
isValidProject = true;
247251

248252
return;
249253
}

0 commit comments

Comments
 (0)