diff flys-backend/src/main/java/de/intevation/flys/model/River.java @ 2373:056b3a5aa181

Removed "NOT NULL" constraint from gauges.range_id because there are gauges which dont have a Gueltigkeitsbereich. flys-backend/trunk@3564 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 02 Jan 2012 13:42:27 +0000
parents 0acf28a3d28a
children 6605dcd6745f
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/model/River.java	Wed Dec 28 12:16:52 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/River.java	Mon Jan 02 13:42:27 2012 +0000
@@ -231,7 +231,9 @@
      * @return the min and max distance of this river.
      */
     public double[] determineMinMaxDistance() {
-        if (gauges == null) {
+        List<Gauge> gauges = getGauges();
+
+        if (gauges == null || gauges.isEmpty()) {
             return null;
         }
 
@@ -240,6 +242,10 @@
         for (Gauge g: gauges) {
             Range r = g.getRange();
 
+            if (r == null) {
+                continue;
+            }
+
             double a  = r.getA().doubleValue();
             minmax[0] = minmax[0] < a ? minmax[0] : a;
 

http://dive4elements.wald.intevation.org