[PATCH 3 of 4] Avoid NPE in discharge context injector if no start km was set

Wald Commits scm-commit at wald.intevation.org
Wed Sep 17 09:04:39 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1410937419 -7200
# Node ID b5bef15c982edbae978d6dae4ae6e854c438798b
# Parent  da7e623cf159c5f13a161f6636d18d8e71f04166
Avoid NPE in discharge context injector if no start km was set.

diff -r da7e623cf159 -r b5bef15c982e artifacts/src/main/java/org/dive4elements/river/exports/injector/DischargeInjector.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/injector/DischargeInjector.java	Wed Sep 17 09:02:44 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/injector/DischargeInjector.java	Wed Sep 17 09:03:39 2014 +0200
@@ -27,6 +27,9 @@
     @Override
     public void injectContext(CallContext ctx, Artifact artifact, Document doc) {
         RangeAccess access = new RangeAccess((D4EArtifact)artifact);
+        if (!access.hasFrom()) {
+            return;
+        }
         double km = access.getFrom();
         Gauge gauge = access.getRiver().determineGaugeByStation(
             km - GAUGE_EPSILON, km + GAUGE_EPSILON);


More information about the Dive4Elements-commits mailing list