Skip to content

Commit d44740e

Browse files
authored
Merge pull request #23 from javier-godoy/feature/npe-refreshCallback
Avoid NPE when MenuItem label/icon is updated
2 parents 303fa5d + 8866b3f commit d44740e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/com/flowingcode/addons/applayout/menu/MenuItem.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ public String getLabel() {
6868

6969
public void setLabel(String label) {
7070
this.label = label;
71-
this.refreshCallback.run();
71+
if (refreshCallback!=null) {
72+
this.refreshCallback.run();
73+
}
7274
}
7375

7476
public Command getCommand() {
@@ -82,10 +84,12 @@ public void setCommand(Command command) {
8284
public String getIcon() {
8385
return icon;
8486
}
85-
87+
8688
public void setIcon(String icon) {
8789
this.icon = icon;
88-
this.refreshCallback.run();
90+
if (refreshCallback!=null) {
91+
this.refreshCallback.run();
92+
}
8993
}
9094

9195
public List<MenuItem> getSubMenuItems() {

0 commit comments

Comments
 (0)