diff --git a/modules/javafx.controls/src/main/java/javafx/scene/control/HeavyweightDialog.java b/modules/javafx.controls/src/main/java/javafx/scene/control/HeavyweightDialog.java index 5744debd3d5..156ed9ee189 100644 --- a/modules/javafx.controls/src/main/java/javafx/scene/control/HeavyweightDialog.java +++ b/modules/javafx.controls/src/main/java/javafx/scene/control/HeavyweightDialog.java @@ -316,7 +316,7 @@ private void updateStageBindings(Window oldOwner, Window newOwner) { stage.renderScaleYProperty().unbind(); Scene oldScene = oldStage.getScene(); - if (scene != null && dialogScene != null) { + if (scene != null && dialogScene != null && oldScene != null) { Bindings.unbindContent(dialogScene.getStylesheets(), oldScene.getStylesheets()); } } @@ -329,7 +329,7 @@ private void updateStageBindings(Window oldOwner, Window newOwner) { stage.renderScaleYProperty().bind(newStage.renderScaleYProperty()); Scene newScene = newStage.getScene(); - if (scene != null && dialogScene != null) { + if (scene != null && dialogScene != null && newScene != null) { Bindings.bindContent(dialogScene.getStylesheets(), newScene.getStylesheets()); } }