changeset 1378:a42d594cef37

RT-22676: Embedded: Ensemble sample throws an exception
author jgiles
date Fri, 29 Jun 2012 09:37:29 +1200
parents 9ed69f9a93bb
children 4484722efef7
files javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeCellBehavior.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeCellBehavior.java	Wed Jun 27 16:03:03 2012 +1200
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeCellBehavior.java	Fri Jun 29 09:37:29 2012 +1200
@@ -138,11 +138,14 @@
     @Override public void mouseDragged(MouseEvent event) {
         latePress = false;
         
+        TreeView treeView = getControl().getTreeView();
+        if (treeView == null || treeView.getSelectionModel() == null) return;
+        
         // the mouse has now been dragged on a touch device, we should
         // remove the selection if we just added it in the last mouse press
         // event
         if (isEmbedded && ! wasSelected && getControl().isSelected()) {
-            getControl().getTreeView().getSelectionModel().clearSelection(getControl().getIndex());
+            treeView.getSelectionModel().clearSelection(getControl().getIndex());
         }
     }