changeset 6548:9987c5a8154a

Prevent accessing min element of empty list, repairing BedDiff Year-Diagrams.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 09 Jul 2013 10:28:52 +0200
parents 455876ac5914
children e7eb3c4afcf3
files artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java	Mon Jul 08 14:50:59 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java	Tue Jul 09 10:28:52 2013 +0200
@@ -103,8 +103,13 @@
             }
             else if (getXBounds(0) == null && getDomainAxisRange() == null) {
                 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);
-                context.putContextValue("startkm", data.getKms().min());
-                context.putContextValue("endkm", data.getKms().max());
+                if (data.getKms().size() >= 0) {
+                    context.putContextValue("startkm", data.getKms().min());
+                    context.putContextValue("endkm", data.getKms().max());
+                }
+                else {
+                    logger.warn("No data to define start and end km");
+                }
             }
             else if (getXBounds(0) == null && getDomainAxisRange() != null){
                 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context);

http://dive4elements.wald.intevation.org