comparison artifacts/src/main/java/org/dive4elements/river/exports/injector/DischargeInjector.java @ 8282:b5bef15c982e

Avoid NPE in discharge context injector if no start km was set.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 17 Sep 2014 09:03:39 +0200
parents c7ca9c228314
children 10917ec29625
comparison
equal deleted inserted replaced
8281:da7e623cf159 8282:b5bef15c982e
25 } 25 }
26 26
27 @Override 27 @Override
28 public void injectContext(CallContext ctx, Artifact artifact, Document doc) { 28 public void injectContext(CallContext ctx, Artifact artifact, Document doc) {
29 RangeAccess access = new RangeAccess((D4EArtifact)artifact); 29 RangeAccess access = new RangeAccess((D4EArtifact)artifact);
30 if (!access.hasFrom()) {
31 return;
32 }
30 double km = access.getFrom(); 33 double km = access.getFrom();
31 Gauge gauge = access.getRiver().determineGaugeByStation( 34 Gauge gauge = access.getRiver().determineGaugeByStation(
32 km - GAUGE_EPSILON, km + GAUGE_EPSILON); 35 km - GAUGE_EPSILON, km + GAUGE_EPSILON);
33 if (gauge == null) { 36 if (gauge == null) {
34 log.error("No Gauge could be found at station " + km + "!"); 37 log.error("No Gauge could be found at station " + km + "!");

http://dive4elements.wald.intevation.org