[PATCH 1 of 2] Avoid NPE in sounding select state if no year is set for bed heights

Wald Commits scm-commit at wald.intevation.org
Thu Apr 3 14:11:08 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1396526461 -7200
# Branch minfo-opt
# Node ID f97162606fa23bfe02ff33363e71dd9666f6fdc1
# Parent  1dbd4668e8efbfd75020fe1241dc781f1a817381
Avoid NPE in sounding select state if no year is set for bed heights.

diff -r 1dbd4668e8ef -r f97162606fa2 artifacts/src/main/java/org/dive4elements/river/artifacts/states/SoundingsSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/SoundingsSelect.java	Fri Mar 28 11:22:55 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/SoundingsSelect.java	Thu Apr 03 14:01:01 2014 +0200
@@ -122,10 +122,12 @@
                 String id    = PREFIX_SINGLE + s.getId();
                 String value = s.getDescription();
 
+                Integer year = s.getYear();
                 Element item = creator.create("item");
                 creator.addAttr(item, "label", value, true);
                 creator.addAttr(item, "value", id, true);
-                creator.addAttr(item, "year", s.getYear().toString());
+                creator.addAttr(item, "year",
+                    year != null ? s.getYear().toString() : "");
                 creator.addAttr(item, "type", s.getType().getName());
                 creator.addAttr(item, "range",
                     nf.format(s.getRange().getA()) +


More information about the Dive4Elements-commits mailing list