changeset 8136:cda45ed151ed

Fix exporter loops The one loop did not increase the count. The other did not handle null gracefully.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 25 Aug 2014 20:12:11 +0200
parents 05aca5659f32
children c200b76145ce
files artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java	Mon Aug 25 20:03:35 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java	Mon Aug 25 20:12:11 2014 +0200
@@ -105,9 +105,13 @@
 
         TreeMap <String, TreeMap <Double, Double[]>> result_map =
             new TreeMap<String, TreeMap<Double, Double[]>>();
-        int i = 0;
-        for (String name: FRACTION_ORDER) {
-            for (Fraction fract: result.getFractionsByName(name)) {
+        for (int i = 0; i < FRACTION_ORDER.length; i++) {
+            String name = FRACTION_ORDER[i];
+            List<Fraction> fractions = result.getFractionsByName(name);
+            if (fractions == null) {
+                continue;
+            }
+            for (Fraction fract: fractions) {
                 String period = fract.getPeriod();
                 TreeMap<Double, Double[]> cur_map;
                 if (result_map.containsKey(period)) {

http://dive4elements.wald.intevation.org