On Fri, 13 Feb 2026 11:36:17 GMT, Dmitry Markov <[email protected]> wrote:
> A NullPointerException occurs when a ContextMenu submenu is opened for the > second time and the graphic and style classes are modified while the menu is > open. > > Fix: Added a null check. modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/ContextMenuContent.java line 1295: > 1293: > label.getStyleClass().removeAll(c.getRemoved()); > 1294: > label.getStyleClass().addAll(c.getAddedSubList()); > 1295: } The reason for the issue is that the `label` field here can be set to null or possibly to another instance (maybe). I wonder if a better approach would be to extract LL1277-1300 into a separate method `createMenuLabel`? in which what used to be a field will be changed to a local variable (rename), and will never be null. What do you think? ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2075#discussion_r2804888479
