[Dive4elements-commits] [PATCH 6 of 6] WaterlevelSelectState: Avoid npe with extreme results

Wald Commits scm-commit at wald.intevation.org
Tue Mar 26 09:34:01 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1364287205 -3600
# Node ID 5bac3e75f59c0e0cdb876586106ad85992be37c9
# Parent  1efe382d86687f35f06c93e18e425ba20d80511f
WaterlevelSelectState: Avoid npe with extreme results.

diff -r 1efe382d8668 -r 5bac3e75f59c flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java	Mon Mar 25 19:53:35 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java	Tue Mar 26 09:40:05 2013 +0100
@@ -15,6 +15,7 @@
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.model.CalculationResult;
 import de.intevation.flys.artifacts.model.WQKms;
+import de.intevation.flys.artifacts.model.extreme.ExtremeResult;
 import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.utils.FLYSUtils;
 import de.intevation.flys.utils.StringUtil;
@@ -123,7 +124,14 @@
             ComputeType.ADVANCE,
             false);
 
-        WQKms[] wqkms = (WQKms[]) rawData.getData();
+        WQKms[] wqkms;
+
+        if (rawData.getData() instanceof ExtremeResult) {
+            wqkms = ((ExtremeResult) rawData.getData()).getWQKms();
+        }
+        else {
+            wqkms = (WQKms[]) rawData.getData();
+        }
 
         int idx = -1;
         try {


More information about the Dive4elements-commits mailing list