Skip to content

Commit

Permalink
fix #803 Calling clear or setValue(null) on DateBox throws a NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Aug 3, 2023
1 parent 5f11beb commit d21c24a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,11 @@ public Date getDate() {
public Calendar setDate(Date date) {
Date oldDate = this.date;
this.date = date;
onDateViewUpdate(this.date);
onDateSelectionChanged(this.date);
triggerChangeListeners(oldDate, this.date);
if (nonNull(date)) {
onDateViewUpdate(this.date);
onDateSelectionChanged(this.date);
triggerChangeListeners(oldDate, this.date);
}
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,13 @@ public Date getValue() {
/** {@inheritDoc} */
@Override
public void onDateSelectionChanged(Date date) {
if (silentSelection == false) {
clearInvalid();
withValue(date);
if (!isDisabled() && !isReadOnly()) {
if (silentSelection == false) {
clearInvalid();
withValue(date);
}
this.popover.close();
}
this.popover.close();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,9 @@ protected void doSetValue(Date value) {
withTimeSelectionToggleListeners(
false,
field -> {
this.timePicker.setDate(this.value);
if (nonNull(this.value)) {
this.timePicker.setDate(this.value);
}
});
}

Expand Down Expand Up @@ -453,11 +455,13 @@ public Date getValue() {
/** {@inheritDoc} */
@Override
public void onTimeSelectionChanged(Date date) {
if (silentSelection == false) {
clearInvalid();
withValue(date);
if (!isDisabled() && !isReadOnly()) {
if (silentSelection == false) {
clearInvalid();
withValue(date);
}
this.popover.close();
}
this.popover.close();
}

/**
Expand Down

0 comments on commit d21c24a

Please sign in to comment.