[PATCH] Prevent accessing min element of empty list, repairing BedDiff Year-Diagrams
Wald Commits
scm-commit at wald.intevation.org
Tue Jul 9 10:20:00 CEST 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1373358532 -7200
# Node ID 9987c5a8154a3a80e0804ed61030ca972c4f3ea2
# Parent 455876ac59147e9af3d43a5f1547f52afff7312b
Prevent accessing min element of empty list, repairing BedDiff Year-Diagrams.
diff -r 455876ac5914 -r 9987c5a8154a artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java
--- 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);
More information about the Dive4elements-commits
mailing list