changeset 7256:2118045d6f67

RT-37493 [StackedAreaChart] does not test for empty series causing AIOOBE Reviewed by: jgiles Contributed by: snorthov
author Martin Sladecek <martin.sladecek@oracle.com>
date Thu, 12 Jun 2014 11:06:44 +0200
parents a208c5310449
children 892d13f9dbf5
files modules/controls/src/main/java/javafx/scene/chart/StackedAreaChart.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/javafx/scene/chart/StackedAreaChart.java	Thu Jun 12 11:03:18 2014 +0200
+++ b/modules/controls/src/main/java/javafx/scene/chart/StackedAreaChart.java	Thu Jun 12 11:06:44 2014 +0200
@@ -698,8 +698,10 @@
             } // end of inner for loop 
             
             // Draw the SeriesLine and Series fill
-            seriesLine.getElements().add(new MoveTo(currentSeriesData.get(0).displayX, currentSeriesData.get(0).displayY));
-            fillPath.getElements().add(new MoveTo(currentSeriesData.get(0).displayX, currentSeriesData.get(0).displayY));
+            if (!currentSeriesData.isEmpty()) {
+                seriesLine.getElements().add(new MoveTo(currentSeriesData.get(0).displayX, currentSeriesData.get(0).displayY));
+                fillPath.getElements().add(new MoveTo(currentSeriesData.get(0).displayX, currentSeriesData.get(0).displayY));
+            }
             for (DataPointInfo<X,Y> point : currentSeriesData) {
                 if (!point.lineTo) {
                     seriesLine.getElements().add(new MoveTo(point.displayX, point.displayY));
@@ -723,7 +725,9 @@
                     fillPath.getElements().add(new  LineTo(point.displayX, point.displayY));
                 }
             }
-            fillPath.getElements().add(new ClosePath());
+            if (!fillPath.getElements().isEmpty()) {
+                fillPath.getElements().add(new ClosePath());
+            }
              
         }  // end of out for loop
      }