changeset 7539:283517a41fbf

[Accessibility] fix NPE in XYChart
author Felipe Heidrich <felipe.heidrich@oracle.com>
date Wed, 16 Jul 2014 20:33:40 -0700
parents c0a468c56309
children ca6d3a083a4c
files modules/controls/src/main/java/javafx/scene/chart/XYChart.java
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/javafx/scene/chart/XYChart.java	Wed Jul 16 14:37:43 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/XYChart.java	Wed Jul 16 20:33:40 2014 -0700
@@ -1356,13 +1356,16 @@
         private ObjectProperty<Node> node = new SimpleObjectProperty<Node>(this, "node") {
             protected void invalidated() {
                 Node node = get();
-                node.accessibleTextProperty().unbind();
-                node.accessibleTextProperty().bind(new StringBinding() {
-                    {bind(currentXProperty(), currentYProperty());} 
-                    @Override protected String computeValue() {
-                        return series.getName() + " X Axis is " + getCurrentX() + " Y Axis is " + getCurrentY();
-                    }
-                });
+                if (node != null) {
+                    node.accessibleTextProperty().unbind();
+                    node.accessibleTextProperty().bind(new StringBinding() {
+                        {bind(currentXProperty(), currentYProperty());}
+                        @Override protected String computeValue() {
+                            String seriesName = series != null ? series.getName() : "";
+                            return seriesName + " X Axis is " + getCurrentX() + " Y Axis is " + getCurrentY();
+                        }
+                    });
+                }
             };
         };
         public final Node getNode() { return node.get(); }