[Dive4elements-commits] [PATCH 3 of 7] QSectorFacet: Guard access to curentKm in context

Wald Commits scm-commit at wald.intevation.org
Wed Nov 14 13:43:24 CET 2012


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1352892405 -3600
# Node ID 976ff4b74b96c5e1a1a5504e2a4db024d96f2dea
# Parent  719680a282e592dbe512043a317a70b0399a6ea2
QSectorFacet: Guard access to curentKm in context.

diff -r 719680a282e5 -r 976ff4b74b96 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QSectorFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QSectorFacet.java	Wed Nov 14 12:25:13 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QSectorFacet.java	Wed Nov 14 12:26:45 2012 +0100
@@ -49,6 +49,11 @@
     @Override
     public Object getData(Artifact artifact, CallContext context) {
         QSectorArtifact qsectorArtifact = (QSectorArtifact) artifact;
+        if (qsectorArtifact == null || context == null ||
+            context.getContextValue("currentKm") == null) {
+            logger.error("No artifact, context or currentKm in QSectorFacet");
+            return null;
+        }
         double currentKm =
             ((Double)context.getContextValue("currentKm")).doubleValue();
         return qsectorArtifact.getQSectors(currentKm, context);


More information about the Dive4elements-commits mailing list