Skip to content

Commit

Permalink
fix: the callback will not be fired, if it's null
Browse files Browse the repository at this point in the history
  • Loading branch information
Milchreis committed Jun 30, 2024
1 parent 55fe8cb commit 83be507
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/de/milchreis/uibooster/model/FormBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ public FormBuilderElementTyped<String> addLabel(String label) {
* @param onClick expects an implementation of Runnable, which is executed when the button is clicked
*/
public FormBuilderElementTyped<String> addButton(String buttonLabel, Runnable onClick) {
return addButton(null, buttonLabel, (element, form) -> onClick.run());
return addButton(null, buttonLabel, (element, form) -> {
if (onClick != null) {
onClick.run();
}
});
}

/**
Expand Down

0 comments on commit 83be507

Please sign in to comment.