changeset 277:05002e14187b

fixed RT-18931 ChoiceBox NPE when StageStyle has been changed twice
author psomashe
date Tue, 17 Jan 2012 17:59:08 -0800
parents 2fc581846b26
children 56dfa29a01f2
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ContextMenuContent.java
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ContextMenuContent.java	Tue Jan 17 18:02:40 2012 -0500
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ContextMenuContent.java	Tue Jan 17 17:59:08 2012 -0800
@@ -284,12 +284,13 @@
     }
 
     private double getScreenHeight() {
-        if (contextMenu == null || contextMenu.getOwnerWindow() == null) {
+        if (contextMenu == null || contextMenu.getOwnerWindow() == null ||
+                contextMenu.getOwnerWindow().getScene() == null) {
             return -1;
         }
         return snapSize(com.sun.javafx.Utils.getScreen(
-                contextMenu.getOwnerWindow().getScene().getRoot()).getVisualBounds().getHeight());
-
+            contextMenu.getOwnerWindow().getScene().getRoot()).getVisualBounds().getHeight());
+        
     }
 
     private double getContentHeight() {