Skip to content

Commit 5008e3b

Browse files
committed
Fix for NPE issue #4527
1 parent 8bf457d commit 5008e3b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

CodenameOne/src/com/codename1/ui/SideMenuBar.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,13 @@ protected void removeCommand(Command cmd) {
635635
leftCommands.remove(cmd);
636636
}
637637
if (getCommandCount() == 0) {
638-
if (getTitleComponent() != null) {
638+
if (getTitleComponent() != null && getTitleComponent().getParent() != null) {
639639
getTitleComponent().getParent().removeAll();
640640
}
641-
getTitleAreaContainer().removeAll();
642-
getTitleAreaContainer().addComponent(BorderLayout.CENTER, getTitleComponent());
641+
if (getTitleAreaContainer() != null) {
642+
getTitleAreaContainer().removeAll();
643+
getTitleAreaContainer().addComponent(BorderLayout.CENTER, getTitleComponent());
644+
}
643645
}
644646
installRightCommands();
645647
installLeftCommands();

0 commit comments

Comments
 (0)