changeset 6939:765cf5fe26c3

DischargeCurveGenerator: Prevent NPE when no gauge can be found. No gauge happens e.g. at Rhein Vollmer-curve-calculations with default values.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 29 Aug 2013 09:14:53 +0200
parents 4c0222d94055
children 274948f91dd6
files artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Wed Aug 28 12:02:56 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Thu Aug 29 09:14:53 2013 +0200
@@ -82,6 +82,10 @@
         // Get gauge which is defined for km
         Gauge gauge =
             RiverUtils.getRiver(artifact).determineGauge(km-0.1d, km+0.1d);
+        if (gauge == null) {
+            logger.error("No Gauge could be found at station " + km + "!");
+            return 0d;
+        }
         double subtractPNP = 0d;
         // Compare to km.
         if (Math.abs(km - gauge.getStation().doubleValue()) < tolerance) {

http://dive4elements.wald.intevation.org