diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java @ 6377:fa8425c8694c

Fix typos and NPEs.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 20 Jun 2013 16:10:58 +0200
parents 48e92ff57f23
children 9a0f8d532797
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java	Thu Jun 20 11:42:47 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java	Thu Jun 20 16:10:58 2013 +0200
@@ -388,13 +388,16 @@
             Object[] row = results.get(i);
             double km = (Double)row[3];
             MeasurementStation station = stations.get(km);
-            MeasurementStation nextStation = stations.ceilingEntry(km + 0.1d).getValue();
+            MeasurementStation nextStation = null;
+            if (stations.ceilingEntry(km + 0.1d) != null) {
+                nextStation = stations.ceilingEntry(km + 0.1d).getValue();
+            }
             Range range = null;
             if (station == null) {
                 log.warn("No measurement station for " + fraction + " km " + km);
             }
             else {
-                if (nextRange != null)
+                if (nextStation != null)
                     range = new Range(station.getRange().getA().doubleValue(),
                         nextStation.getRange().getA().doubleValue());
                 else {

http://dive4elements.wald.intevation.org