[Dive4elements-commits] [PATCH 1 of 6] Avoid NullPointerExceptions if no settings are available

Wald Commits scm-commit at wald.intevation.org
Fri Nov 2 15:57:10 CET 2012


# HG changeset patch
# User Björn Ricks <bjoern.ricks at intevation.de>
# Date 1351867312 -3600
# Node ID 3c8964855270ff566addaa583c174a540841d589
# Parent  532272d9f2e063a0210552011e46bbb110571fa3
Avoid NullPointerExceptions if no settings are available

Don't fail with a NullPointerExceptions if no setting for the axis is available.

diff -r 532272d9f2e0 -r 3c8964855270 flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Fri Nov 02 15:38:08 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Fri Nov 02 15:41:52 2012 +0100
@@ -1177,6 +1177,9 @@
         YAxisWalker walker = getYAxisWalker();
 
         AxisSection   as = chartSettings.getAxisSection(walker.getId(pos));
+        if (as == null) {
+            return DEFAULT_FONT_SIZE;
+        }
         Integer fontSize = as.getFontSize();
 
         return fontSize != null ? fontSize : DEFAULT_FONT_SIZE;
@@ -1250,6 +1253,11 @@
         }
 
         AxisSection as = chartSettings.getAxisSection(axisId);
+
+        if (as == null) {
+            return null;
+        }
+
         Boolean  fixed = as.isFixed();
 
         if (fixed != null && fixed) {


More information about the Dive4elements-commits mailing list