[Schmitzm-commits] r1101 - trunk/src/schmitzm/jfree

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Oct 11 13:57:39 CEST 2010


Author: alfonx
Date: 2010-10-11 13:57:39 +0200 (Mon, 11 Oct 2010)
New Revision: 1101

Modified:
   trunk/src/schmitzm/jfree/JFreeChartUtil.java
Log:
IndexOutOfBoundsException vermeiden in JFreeChartUtil.createRegressionLineDataset wenn keine Daten vorhanden.

Modified: trunk/src/schmitzm/jfree/JFreeChartUtil.java
===================================================================
--- trunk/src/schmitzm/jfree/JFreeChartUtil.java	2010-10-11 00:07:14 UTC (rev 1100)
+++ trunk/src/schmitzm/jfree/JFreeChartUtil.java	2010-10-11 11:57:39 UTC (rev 1101)
@@ -957,8 +957,14 @@
 	public static XYDataset createRegressionLineDataset(
 			XYSeriesCollection dataset, int series, String seriesKey,
 			int sampleCount) {
-		double minX = dataset.getSeries(0).getMinX();
-		double maxX = dataset.getSeries(0).getMaxX();
+		
+		double minX = Double.MIN_VALUE;
+		double maxX = Double.MAX_VALUE;
+		
+		if (dataset.getSeriesCount() > 0) {
+			minX = dataset.getSeries(0).getMinX();
+			maxX = dataset.getSeries(0).getMaxX();
+		} 
 		return createRegressionLineDataset(dataset, series, seriesKey, minX,
 				maxX, sampleCount);
 	}



More information about the Schmitzm-commits mailing list