changeset 7483:f206f6049b2b

Dont assume that wqdays are always of none zero length.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 31 Oct 2013 18:26:49 +0100
parents f8e1af4e2f69
children 8b614d152a79
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java	Thu Oct 31 18:25:26 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java	Thu Oct 31 18:26:49 2013 +0100
@@ -58,6 +58,11 @@
      * Employ linear interpolation.
      */
     protected static void setHitPoint(WQDay wqday, StickyAxisAnnotation annotation) {
+
+        if (wqday.size() == 0) {
+            return;
+        }
+
         int idx = 0;
         float q = annotation.getPos();
         boolean qIncreases = wqday.getQ(0) < wqday.getQ(wqday.size()-1);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java	Thu Oct 31 18:25:26 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java	Thu Oct 31 18:26:49 2013 +0100
@@ -54,6 +54,11 @@
      * Employ linear interpolation.
      */
     protected static void setHitPoint(WQDay wqday, StickyAxisAnnotation annotation) {
+
+        if (wqday.size() == 0) {
+            return;
+        }
+
         int idx = 0;
         float w = annotation.getPos();
         boolean wIncreases = wqday.getW(0) < wqday.getW(wqday.size()-1);

http://dive4elements.wald.intevation.org