changeset 4195:466bd0a9e22b

RT-30123: [SwingNode] : Something in SwingNode throws NullPointerException Reviewed-by: art
author ant <anton.tarasov@oracle.com>
date Mon, 08 Jul 2013 16:13:57 +0400
parents 2f9f7e525e2d
children d8efc7324c17
files modules/swing/src/main/java/javafx/embed/swing/SwingNode.java
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/swing/src/main/java/javafx/embed/swing/SwingNode.java	Mon Jul 08 13:36:38 2013 +0200
+++ b/modules/swing/src/main/java/javafx/embed/swing/SwingNode.java	Mon Jul 08 16:13:57 2013 +0400
@@ -535,7 +535,10 @@
             Platform.runLater(new Runnable() {
                 @Override
                 public void run() {
-                    if (getScene() != null && getScene().getWindow() != null) {
+                    if (getScene() != null &&
+                        getScene().getWindow() != null &&
+                        getScene().getWindow().impl_getPeer() != null)
+                    {
                         getScene().getWindow().impl_getPeer().grabFocus();
                         grabbed = true;
                     }
@@ -555,7 +558,9 @@
 
     private void ungrabFocus(boolean postUngrabEvent) {
         if (grabbed &&
-            getScene() != null && getScene().getWindow() != null)
+            getScene() != null &&
+            getScene().getWindow() != null &&
+            getScene().getWindow().impl_getPeer() != null)
         {
             skipBackwardUnrgabNotification = !postUngrabEvent;
             getScene().getWindow().impl_getPeer().ungrabFocus();